結果

問題 No.1004 サイコロの実装 (2)
コンテスト
ユーザー lemon
提出日時 2021-05-08 14:37:26
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
WA  
実行時間 -
コード長 549 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 503 ms
コンパイル使用メモリ 20,700 KB
実行使用メモリ 15,488 KB
最終ジャッジ日時 2026-04-05 23:04:42
合計ジャッジ時間 6,785 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 6 WA * 18 TLE * 1 -- * 13
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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