結果

問題 No.1004 サイコロの実装 (2)
ユーザー gew1fw
提出日時 2025-06-12 18:59:20
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 473 bytes
コンパイル時間 191 ms
コンパイル使用メモリ 82,760 KB
実行使用メモリ 83,492 KB
最終ジャッジ日時 2025-06-12 18:59:31
合計ジャッジ時間 4,993 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 7 WA * 17 TLE * 1 -- * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

a, b, x0, N = map(int, input().split())

t_black = t_white = 0
a_black = a_white = 0
t_pos = a_pos = 0
x = x0

for i in range(N):
    x = (a * x + b) % (2**32)
    d = (x % 6) + 1
    if i % 2 == 0:
        t_pos += d
        if t_pos % 2 == 1:
            t_black += 1
        else:
            t_white += 1
    else:
        a_pos += d
        if a_pos % 2 == 1:
            a_black += 1
        else:
            a_white += 1

print(t_black * t_white, a_black * a_white)
0