結果

問題 No.1004 サイコロの実装 (2)
ユーザー okok
提出日時 2020-03-06 23:21:29
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 944 bytes
コンパイル時間 1,007 ms
コンパイル使用メモリ 82,408 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-22 10:36:20
合計ジャッジ時間 4,216 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 1 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 3 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 1 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 3 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 3 ms
5,376 KB
testcase_25 AC 2 ms
5,376 KB
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
} fio;

signed main(){
	cout<<fixed<<setprecision(10);
	
	unsigned int a, b, x0, N;
	// int taka0 = 0, taka1 = 0, ao0 = 0, ao1 = 0, nowt = 0, nowa = 0;
	int  nowt = 0, nowa = 0;
	int taka[2] = {}, ao[2] = {};
	vector<unsigned int> x(1);
	
	cin>>a>>b>>x[0]>>N;
	
	x.resize(N * 2+1);
	
	for(int i = 1; i <= N * 2; i++){
		x[i] = x[i-1] * a + b;
		
		// cout<<"i = "<<i<<" "<<x[i]<<" "<<x[i]%6+1<<endl;
		
		if(i%2) nowt += x[i] % 6 + 1, taka[nowt%2]++;
		else nowa += x[i] % 6 + 1, ao[nowa%2]++;
	}
	
	cout<<min(taka[0], taka[1])<<" "<<min(ao[0], ao[1])<<endl;
	
	
	return 0;
}
0