結果
| 問題 | No.726 Tree Game |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-08-24 21:53:59 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 96 ms / 2,000 ms |
| コード長 | 640 bytes |
| 記録 | |
| コンパイル時間 | 98 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 12,544 KB |
| 最終ジャッジ日時 | 2024-06-23 07:13:14 |
| 合計ジャッジ時間 | 3,056 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 |
コンパイルメッセージ
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
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"