結果

問題 No.567 コンプリート
ユーザー chocopuuchocopuu
提出日時 2019-02-24 20:48:06
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 524 ms / 2,000 ms
コード長 1,129 bytes
コンパイル時間 1,652 ms
コンパイル使用メモリ 163,408 KB
実行使用メモリ 58,320 KB
最終ジャッジ日時 2023-08-25 04:40:07
合計ジャッジ時間 3,217 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,384 KB
testcase_05 AC 2 ms
4,384 KB
testcase_06 AC 2 ms
4,384 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,384 KB
testcase_09 AC 2 ms
4,384 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,384 KB
testcase_13 AC 2 ms
4,384 KB
testcase_14 AC 1 ms
4,388 KB
testcase_15 AC 524 ms
58,320 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:38:24: 警告: iteration 6 invokes undefined behavior [-Waggressive-loop-optimizations]
   38 |             dp[i+1][j+1]+=dp[i][j]*(6-j)/6;
      |             ~~~~~~~~~~~^
main.cpp:10:35: 備考: within this loop
   10 | #define rep(i,s,n) for(int i = s;i<n;i++)
      |                                   ^
main.cpp:37:9: 備考: in expansion of macro ‘rep’
   37 |         rep(j,0,7){
      |         ^~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
 
#define int long long
//#define uint __int128_t
 
#define pb push_back
#define fi first
#define se second
#define rep(i,s,n) for(int i = s;i<n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<vint> vvint;
typedef vector<pint>vpint;
typedef pair<pint,int> P1;
typedef pair<int,pint> P2;
typedef pair<pint,pint> PP;
const ll MOD=1000000007,INF=1e18;

int N;
double dp[1000100][7];

signed main() {
    IOS();
    //(1ll<<N)シフト演算のオーバーフローに気をつける
    //MOD同士の引き算に注意
    cin>>N;
    dp[0][0]=1;
    rep(i,0,N){
        rep(j,0,7){
            dp[i+1][j+1]+=dp[i][j]*(6-j)/6;
            dp[i+1][j]+=dp[i][j]*j/6;
        }
    }
    printf("%.18lf",dp[N][6]);
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    return 0;
}
0