結果
| 問題 |
No.1004 サイコロの実装 (2)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-03-06 21:52:56 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 638 bytes |
| コンパイル時間 | 793 ms |
| コンパイル使用メモリ | 72,352 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-14 06:35:00 |
| 合計ジャッジ時間 | 1,933 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 6 WA * 32 |
ソースコード
#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(){
int a,b,x,n;
cin >> a >> b >> x >> n;
int d;
int tb=0,tw=0;
int ab=0,aw=0;
int tnow=0;
int anow=0;
int tans,aans;
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;
}