結果
問題 | No.726 Tree Game |
ユーザー | mai |
提出日時 | 2018-08-24 21:53:24 |
言語 | Ruby (3.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 655 bytes |
コンパイル時間 | 324 ms |
コンパイル使用メモリ | 11,200 KB |
実行使用メモリ | 15,432 KB |
最終ジャッジ日時 | 2023-09-05 11:34:19 |
合計ジャッジ時間 | 3,908 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | AC | 96 ms
15,224 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | AC | 95 ms
15,204 KB |
testcase_08 | AC | 94 ms
15,224 KB |
testcase_09 | AC | 94 ms
15,168 KB |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | AC | 94 ms
15,316 KB |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
コンパイルメッセージ
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"