結果

問題 No.1004 サイコロの実装 (2)
コンテスト
ユーザー pengin_2000
提出日時 2021-07-11 02:45:26
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
WA  
実行時間 -
コード長 537 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 177 ms
コンパイル使用メモリ 39,364 KB
最終ジャッジ日時 2026-02-22 07:30:07
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 6 WA * 18 TLE * 1 -- * 13
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<stdio.h>
int main()
{
	unsigned int a, b, x, n;
	scanf("%d %d %d %d", &a, &b, &x, &n);
	long long int c[2][2], i;
	c[0][0] = c[0][1] = c[1][0] = c[1][1] = 0;
	for (i = 0; i < (long long int)n; i++)
	{
		x = a * x + b;
		if (x % 6 % 2 > 0)
			c[0][0]++;
		else
			c[0][1]++;
		x = a * x + b;
		if (x % 6 % 2 > 0)
			c[1][0]++;
		else
			c[1][1]++;
	}
	if (c[0][0] < c[0][1])
		printf("%d ", c[0][0]);
	else
		printf("%d ", c[0][1]);
	if (c[1][0] < c[1][1])
		printf("%d\n", c[1][0]);
	else
		printf("%d\n", c[1][1]);
	return 0;
}
0