結果
問題 | No.58 イカサマなサイコロ |
ユーザー |
|
提出日時 | 2015-06-19 03:47:32 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 192 ms / 5,000 ms |
コード長 | 357 bytes |
コンパイル時間 | 428 ms |
コンパイル使用メモリ | 65,804 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-07 03:51:02 |
合計ジャッジ時間 | 1,912 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:7:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 | scanf("%d%d",&N,&K); | ~~~~~^~~~~~~~~~~~~~
ソースコード
#include <vector>#include <random>#include <cstdio>using namespace std;int main(){int N,K,T=999999,S=0,I=0;scanf("%d%d",&N,&K);uniform_int_distribution<int>g(1,6),h(4,6);mt19937_64 e(0);for(;I<T;I++){int a=0,b=0,i=0;for(;i<N;i++)a+=g(e),b+=i<K?h(e):g(e);if(a<b)S++;}printf("%f\n",S*1.0/T);}