結果
問題 | No.1004 サイコロの実装 (2) |
ユーザー |
![]() |
提出日時 | 2021-01-31 11:24:24 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 549 bytes |
コンパイル時間 | 1,917 ms |
コンパイル使用メモリ | 192,124 KB |
最終ジャッジ日時 | 2025-01-18 10:14:47 |
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 24 TLE * 14 |
ソースコード
#include <bits/stdc++.h>using namespace std;typedef long long ll;int main(){ll a,b,x,n;cin>>a>>b>>x>>n;ll tw=0;ll aw=0;ll tb=0;ll ab=0;ll temp=x;ll td=0;ll ad=0;for(ll i=0;i<n*2;i++){temp=(a*temp+b)%4294967296;if(i%2==0){td+=(temp%6+1);if(td%2==0){tw++;}else{tb++;}}else{ad+=(temp%6+1);if(ad%2==0){aw++;}else{ab++;}}}cout<<min(tb,tw)<<" "<<min(aw,ab)<<endl;return 0;}