結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
42,368 KB
testcase_01 AC 78 ms
42,372 KB
testcase_02 AC 78 ms
42,312 KB
testcase_03 AC 78 ms
42,276 KB
testcase_04 AC 77 ms
42,272 KB
testcase_05 AC 78 ms
42,188 KB
testcase_06 WA -
testcase_07 AC 78 ms
42,280 KB
testcase_08 AC 78 ms
42,220 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 78 ms
42,396 KB
testcase_12 WA -
testcase_13 AC 78 ms
42,308 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 79 ms
42,508 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 78 ms
42,196 KB
testcase_22 AC 78 ms
42,172 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 78 ms
42,344 KB
testcase_26 AC 79 ms
42,208 KB
testcase_27 AC 79 ms
42,248 KB
testcase_28 AC 78 ms
42,304 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 79 ms
42,340 KB
testcase_33 WA -
testcase_34 AC 78 ms
42,576 KB
testcase_35 AC 79 ms
42,372 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 78 ms
42,212 KB
testcase_39 AC 78 ms
42,248 KB
権限があれば一括ダウンロードができます

ソースコード

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 % 1 == 0) 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