結果

問題 No.7 プライムナンバーゲーム
ユーザー letrangerjpletrangerjp
提出日時 2017-05-13 07:46:11
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 222 bytes
コンパイル時間 137 ms
コンパイル使用メモリ 11,564 KB
実行使用メモリ 15,544 KB
最終ジャッジ日時 2023-10-13 15:07:10
合計ジャッジ時間 2,670 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
15,264 KB
testcase_01 AC 92 ms
15,220 KB
testcase_02 AC 91 ms
15,192 KB
testcase_03 WA -
testcase_04 AC 95 ms
15,224 KB
testcase_05 AC 91 ms
15,300 KB
testcase_06 WA -
testcase_07 AC 93 ms
15,308 KB
testcase_08 WA -
testcase_09 AC 90 ms
15,204 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 91 ms
15,396 KB
testcase_13 AC 92 ms
15,348 KB
testcase_14 AC 93 ms
15,364 KB
testcase_15 WA -
testcase_16 AC 94 ms
15,392 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

require "prime"

def f(n)
  g = lambda{|n, initiative|
    return initiative if (n - 2).prime?
    return initiative if (n - 3).prime?
    g.(n-2, !initiative)
  }
  g.(n, true)
end

N = gets.to_i
puts f(N) ? :Win : :Lose
0