結果
問題 | No.58 イカサマなサイコロ |
ユーザー | naimonon77 |
提出日時 | 2016-01-04 18:36:09 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 411 ms / 5,000 ms |
コード長 | 718 bytes |
コンパイル時間 | 1,253 ms |
コンパイル使用メモリ | 159,348 KB |
実行使用メモリ | 4,348 KB |
最終ジャッジ日時 | 2023-10-19 15:05:21 |
合計ジャッジ時間 | 4,164 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 85 ms
4,348 KB |
testcase_01 | AC | 411 ms
4,348 KB |
testcase_02 | AC | 85 ms
4,348 KB |
testcase_03 | AC | 45 ms
4,348 KB |
testcase_04 | AC | 249 ms
4,348 KB |
testcase_05 | AC | 287 ms
4,348 KB |
testcase_06 | AC | 367 ms
4,348 KB |
testcase_07 | AC | 86 ms
4,348 KB |
testcase_08 | AC | 166 ms
4,348 KB |
testcase_09 | AC | 367 ms
4,348 KB |
コンパイルメッセージ
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; }