結果

問題 No.726 Tree Game
ユーザー finefine
提出日時 2018-08-24 22:27:12
言語 Ruby
(3.4.1)
結果
WA  
実行時間 -
コード長 312 bytes
コンパイル時間 177 ms
コンパイル使用メモリ 7,680 KB
実行使用メモリ 12,544 KB
最終ジャッジ日時 2024-06-23 08:00:25
合計ジャッジ時間 3,895 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19 WA * 6
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

require 'prime'

def solve(x)
    res = 0
    while x.prime?.!
        res += 1
        x += 1
    end
    if res > 0
        res -= 1
    end
    return res
end

y, x = gets.split.map(&:to_i)
if x.prime? || y.prime?
    puts :First
    exit
end
cnt = solve(y) + solve(x)
puts ((cnt % 2 == 1) ? :First : :Second)
0