結果

問題 No.1004 サイコロの実装 (2)
ユーザー tsuchinagatsuchinaga
提出日時 2020-10-04 23:05:00
言語 TypeScript
(5.4.3)
結果
WA  
実行時間 -
コード長 642 bytes
コンパイル時間 10,337 ms
コンパイル使用メモリ 251,760 KB
実行使用メモリ 44,456 KB
最終ジャッジ日時 2023-09-27 00:41:51
合計ジャッジ時間 12,553 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
42,236 KB
testcase_01 AC 76 ms
42,308 KB
testcase_02 AC 74 ms
42,316 KB
testcase_03 AC 75 ms
42,352 KB
testcase_04 AC 73 ms
42,240 KB
testcase_05 AC 72 ms
42,428 KB
testcase_06 AC 75 ms
42,216 KB
testcase_07 AC 73 ms
42,220 KB
testcase_08 WA -
testcase_09 AC 72 ms
42,220 KB
testcase_10 AC 74 ms
42,384 KB
testcase_11 WA -
testcase_12 AC 72 ms
42,208 KB
testcase_13 AC 71 ms
42,240 KB
testcase_14 AC 72 ms
42,372 KB
testcase_15 AC 74 ms
42,380 KB
testcase_16 AC 72 ms
42,400 KB
testcase_17 WA -
testcase_18 AC 70 ms
42,444 KB
testcase_19 AC 73 ms
42,304 KB
testcase_20 AC 75 ms
42,220 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 74 ms
42,212 KB
testcase_24 AC 74 ms
44,256 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 74 ms
42,416 KB
testcase_30 AC 74 ms
42,300 KB
testcase_31 AC 74 ms
42,376 KB
testcase_32 WA -
testcase_33 AC 73 ms
42,344 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

function issue1004(input: string) {
    let inputs = input.trim().split(" ").map((a: string): number => Number(a))
    let a = inputs[0]
    let b = inputs[1]
    let x0 = inputs[2]
    let n = inputs[3]
    let m = 2 ** 32

    // 奇数と偶数が繰り返されるため、最初が奇数なら一人目が、最初が偶数なら二人目が勝つ
    let x = (a * x0 + b) % m
    let w = Math.floor(n / 2)
    if (x % 2 == 1) console.log([w, 0].join(" "))
    else console.log([0, w].join(" "))
}

let path: string = "/dev/stdin"
if (process.platform == "win32") path = "./stdin.txt"
issue1004(require('fs').readFileSync(path, 'utf8'))
0