結果
問題 | No.58 イカサマなサイコロ |
ユーザー | kongarishisyamo |
提出日時 | 2016-02-28 02:56:23 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 4,038 ms / 5,000 ms |
コード長 | 426 bytes |
コンパイル時間 | 369 ms |
コンパイル使用メモリ | 55,952 KB |
実行使用メモリ | 4,348 KB |
最終ジャッジ日時 | 2023-10-24 18:43:58 |
合計ジャッジ時間 | 22,964 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 822 ms
4,348 KB |
testcase_01 | AC | 4,038 ms
4,348 KB |
testcase_02 | AC | 819 ms
4,348 KB |
testcase_03 | AC | 419 ms
4,348 KB |
testcase_04 | AC | 2,429 ms
4,348 KB |
testcase_05 | AC | 2,831 ms
4,348 KB |
testcase_06 | AC | 3,636 ms
4,348 KB |
testcase_07 | AC | 821 ms
4,348 KB |
testcase_08 | AC | 1,629 ms
4,348 KB |
testcase_09 | AC | 3,638 ms
4,348 KB |
ソースコード
#include<iostream> #include<cstdio> #include<cstdlib> using namespace std; int main(){ srand(2); int xi[]={1,2,3,4,5,6}; int ixi[]={4,5,6,4,5,6}; int N,K; int tw=0,zw=0; int i=0; cin>>N>>K; while(i<10000000){ int tp=0,zp=0; for(int i=0;i<N;i++){ if(i<K) tp+=ixi[rand()%6]; else tp+=xi[rand()%6]; zp+=xi[rand()%6]; } if(tp>zp) tw++; else zw++; i++; } printf("%.3f\n",(double)tw/(tw+zw)); }