結果

問題 No.1004 サイコロの実装 (2)
ユーザー T.Stream
提出日時 2020-04-14 12:29:28
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 369 bytes
コンパイル時間 2,656 ms
コンパイル使用メモリ 192,944 KB
最終ジャッジ日時 2025-01-09 18:34:15
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 6 WA * 19 TLE * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
	unsigned int a,b,x,n;
	cin >> a >> b >> x >> n;
	vector<long> ans(4,0); 
	for(long i=0; i<n; i++){
		x=a*x+b;
		if(x%2==1){
			ans[0]++;
		}else{
			ans[1]++;
		}
		x=a*x+b;
		if(x%2==1){
			ans[2]++;
		}else{
			ans[3]++;
		}
	}
	cout << min(ans[0],ans[1]) << ' ' << min(ans[2],ans[3]) << endl;
	return 0;
}
0