結果

問題 No.1004 サイコロの実装 (2)
ユーザー yuya
提出日時 2020-03-06 21:51:29
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 683 bytes
コンパイル時間 125 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 16,680 KB
最終ジャッジ日時 2024-10-14 06:22:06
合計ジャッジ時間 3,101 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 6 WA * 18 RE * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 2**32

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

listlist = [0] * (n*2)

for i in range(0, len(listlist)):
    tmp = a * x % mod
    tmp = (tmp + b) % mod
    x = tmp
    listlist[i] = tmp

taka = []
aoki = []
for i in range(len(listlist)):
    flag = True
    if listlist[i] % 2 == 0:
        flag = True
    else: 
        flag = False

    if i % 2 == 0:
        if flag:
            taka.append(1)
        else:
            taka.append(0)

    else:
        if flag:
            aoki.append(1)
        else:
            aoki.append(0)

takacount = str(min(taka.count(1), taka.count(0)))
aoki = str(min(aoki.count(1), aoki.count(0)))

print(takacount + ' ' + aoki)

        

0