結果
| 問題 |
No.726 Tree Game
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-08-24 21:53:24 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 655 bytes |
| コンパイル時間 | 210 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 12,672 KB |
| 最終ジャッジ日時 | 2024-06-23 07:12:40 |
| 合計ジャッジ時間 | 3,532 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 5 WA * 20 |
コンパイルメッセージ
Syntax OK
ソースコード
require 'prime'
def yarudake(y, x, t = 0)
return true if t > 0 && ((y).prime? || (x).prime?)
#return false if (y+1).prime? && (x+1).prime?
return true if !yarudake(y+1, x, 1)
return true if !yarudake(y, x+1, 1)
return false
end
def solve(y, x)
return false if y == 2 || x == 2
ty = tx = 0
while ty == 0 || !y.prime?
ty += 1
y += 1
end
while tx == 0 || !x.prime?
tx += 1
x += 1
end
p [ty, tx]
return (ty+tx-2).even? ? false : true
end
y,x = gets.split.map(&:to_i)
puts solve(y, x) ? "First" : "Second"
#puts yarudake(y, x) ? "First" : "Second"