結果
| 問題 |
No.58 イカサマなサイコロ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-01-04 18:36:09 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 374 ms / 5,000 ms |
| コード長 | 718 bytes |
| コンパイル時間 | 2,192 ms |
| コンパイル使用メモリ | 157,792 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-19 11:13:40 |
| 合計ジャッジ時間 | 3,622 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:18:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
18 | scanf("%llu %llu",&N,&K);
| ~~~~~^~~~~~~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h>
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
/* ここからが本編 */
/* */
int main(void)
{
ull i,j,k;
ull N,K;
ull tarou_win = 0;
ull trial_cnt = 1000000;
scanf("%llu %llu",&N,&K);
// cin >> N >> K;
// tarouがせこする
for(i=0;i<trial_cnt;i++) {
ull tarou_sum = 0,zirou_sum = 0;
for(j=0;j<K;j++) {
tarou_sum += rand() % 3 + 4;
}
for(;j<N;j++) {
tarou_sum += rand() % 6 + 1;
}
for(j=0;j<N;j++) {
zirou_sum += rand() % 6 + 1;
}
if(tarou_sum > zirou_sum) tarou_win++;
}
printf("%lf\n",(double)tarou_win/trial_cnt);
return 0;
}