結果

問題 No.1004 サイコロの実装 (2)
ユーザー lemon
提出日時 2021-05-08 14:37:26
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 549 bytes
コンパイル時間 415 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 16,000 KB
最終ジャッジ日時 2024-09-16 19:09:11
合計ジャッジ時間 5,160 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 6 WA * 18 TLE * 1 -- * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10 ** 6)
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()
nsa = lambda: list(stdin.readline().split())
mod = 10 * 7 + 7

a, b, x, n = na()
m = 1 << 32
T = [0, 0]
A = [0, 0]

for i in range(n):
    x = (a * x + b) % m
    if i % 2 == 0:
        if x % 2 == 0:
            A[0] += 1
        else:
            A[1] += 1
    else:
        if x % 2 == 0:
            T[0] += 1
        else:
            T[1] += 1

print(min(T), min(A))
0