結果
| 問題 | No.58 イカサマなサイコロ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-14 01:41:22 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 1,200 ms / 5,000 ms |
| コード長 | 371 bytes |
| コンパイル時間 | 2,190 ms |
| コンパイル使用メモリ | 193,856 KB |
| 最終ジャッジ日時 | 2025-01-09 18:21:23 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:11:23: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | int n,k; scanf("%d%d",&n,&k);
| ~~~~~^~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
random_device seed_gen;
mt19937 rng(seed_gen());
int main(){
int n,k; scanf("%d%d",&n,&k);
int cnt=0;
rep(_,1e7){
int sum=0;
rep(i,n){
sum+=rng()%6+1;
if(i<k) sum-=rng()%3+4;
else sum-=rng()%6+1;
}
if(sum<0) cnt++;
}
printf("%.9f\n",cnt/1e7);
return 0;
}