結果

問題 No.1004 サイコロの実装 (2)
ユーザー zezero
提出日時 2020-03-06 22:03:02
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 639 bytes
コンパイル時間 573 ms
コンパイル使用メモリ 72,652 KB
実行使用メモリ 10,020 KB
最終ジャッジ日時 2024-10-14 07:03:34
合計ジャッジ時間 5,984 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 24 WA * 1 TLE * 1 -- * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i=0;i < (int)(n);i++)
const ll INF = 1LL << 60;

int main(){
 unsigned int a,b,x,n;
 cin >> a >> b >> x >> n;
 unsigned int d;
 ll tb=0,tw=0;
 ll ab=0,aw=0;
 int tnow=0;
 int anow=0;

 for (int i=0;i < 2*n;i++){
   x=x*a+b;
   d=(x)%6+1;
   if (i%2==0){
     tnow+=d;
     tnow%=2;
     if (tnow ==1) tb++;
     else tw++;
   }
   else{
     anow+=d;
     anow%=2;
     if (anow==1) ab++;
     else aw++;
   }
 }
 cout << min(tb,tw) << " " << min(ab,aw) << endl;
 return 0; 
}
0