結果

問題 No.1004 サイコロの実装 (2)
ユーザー okok
提出日時 2020-03-07 00:11:54
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,205 bytes
コンパイル時間 706 ms
コンパイル使用メモリ 78,864 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-22 11:01:58
合計ジャッジ時間 1,774 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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);
	
	
	bool tf = true, af = true;
	unsigned int a, b, x, N;
	int  nowt = 0, nowa = 0;
	int taka[2] = {}, ao[2] = {};
	
	cin>>a>>b>>x>>N;
	
	// for(int i = 1; i <= N * 2; i++){
		// x = x * a + b;
		
		// cout<<"i = "<<i<<" "<<x<<" "<<x%6+1<<" "<<nowt<<" "<<nowa<<endl;
		
		// if(i%2) nowt += x % 6 + 1, taka[nowt%2]++;
		// else nowa += x % 6 + 1, ao[nowa%2]++;
	// }
	
	// cout<<min(taka[0], taka[1])<<" "<<min(ao[0], ao[1])<<endl;
	
	int ans1 = 0, ans2 = 0;
	
	if(a % 2) {
		if(a % 2) {
			if(x % 2) {
				ans1 = N / 2;
			} else {
				ans2 = N / 2;
			}
		} else {
			if(x % 2) {
				ans1 = ans2 = 0;
			} else {
				ans1 = ans2 = N / 2;
			}
		}
	} else {
		if(b % 2) {
			ans1 = ans2 = 0;
		} else {
			ans1 = ans2 = N / 2;
		}
	}
	
	cout<<ans1<<" "<<ans2<<endl;
	
	return 0;
}
0