結果

問題 No.1004 サイコロの実装 (2)
ユーザー konchanksu
提出日時 2020-03-06 21:40:14
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 375 bytes
コンパイル時間 82 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 15,872 KB
最終ジャッジ日時 2024-10-14 04:47:31
合計ジャッジ時間 5,025 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 6 WA * 18 TLE * 1 -- * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

def move(x):
    x = a * x + b
    if 2 ** 32 < x:
        x = x % (2 ** 32)
    return x

def play(x, p, ans):
    move(x)
    p += x
    if x % 2 == 0:
        ans += 1
    return x, p, ans

a, b, x, n = map(int, input().split())

p1, p2 = 0, 0
ans1, ans2 = 0, 0
for i in range(n):
    x, p1, ans1 = play(x, p1, ans1)
    x, p2, ans2 = play(x, p2, ans2)

print(ans1, ans2)
0