結果
| 問題 |
No.1004 サイコロの実装 (2)
|
| コンテスト | |
| ユーザー |
pengin_2000
|
| 提出日時 | 2021-07-11 02:47:42 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 580 bytes |
| コンパイル時間 | 192 ms |
| コンパイル使用メモリ | 29,952 KB |
| 実行使用メモリ | 10,624 KB |
| 最終ジャッジ日時 | 2024-07-02 02:57:52 |
| 合計ジャッジ時間 | 4,028 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 6 WA * 18 TLE * 1 -- * 13 |
ソースコード
#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, j = 0;
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;
j ^= x % 6 % 2 + 1;
if (j % 2 > 0)
c[0][0]++;
else
c[0][1]++;
x = a * x + b;
j ^= x % 6 % 2 + 1;
if (j % 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;
}
pengin_2000