結果
問題 |
No.1004 サイコロの実装 (2)
|
ユーザー |
![]() |
提出日時 | 2020-03-06 22:03:24 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 594 bytes |
コンパイル時間 | 2,443 ms |
コンパイル使用メモリ | 191,484 KB |
最終ジャッジ日時 | 2025-01-09 05:09:17 |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 6 WA * 20 TLE * 12 |
ソースコード
#include <bits/stdc++.h> using namespace std; using Int = long long; template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;} //INSERT ABOVE HERE signed main(){ cin.tie(0); ios::sync_with_stdio(0); using uint = unsigned int; uint a,b,x; long long n; cin>>a>>b>>x>>n; int cs[2][2]={}; int ps[2]={}; for(int i=0;i<n;i++){ x=a*x+b; ps[i&1]=(ps[i&1]+x+1)&1; cs[i&1][ps[i&1]&1]++; } cout<<min(cs[0][0],cs[0][1])<<" "<<min(cs[1][0],cs[1][1])<<endl; return 0; }