結果
問題 |
No.715 集合と二人ゲーム
|
ユーザー |
|
提出日時 | 2018-07-13 22:49:00 |
言語 | Ruby (3.4.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 556 bytes |
コンパイル時間 | 46 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 54,912 KB |
最終ジャッジ日時 | 2024-10-09 05:22:13 |
合計ジャッジ時間 | 11,440 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 WA * 35 |
コンパイルメッセージ
Syntax OK
ソースコード
def ascan; gets.split.map(&:to_i); end gets aa = ascan.sort lis = [1] aa.each_cons(2) do |a,b| if (b-a).abs <= 1 lis[-1] += 1 else lis << 1 end end hoge = lis.map{|e| e%4}.reduce(:^) # p lis.map{|e| e%4} puts hoge == 0 ? :Second : :First #true => first def guchoku(set, turn = true) return !turn if set.empty? set.each do |e| new_set = set.select{|x| (x-e).abs > 1} return turn if guchoku(new_set, !turn) == turn end return !turn end #p guchoku(aa) # 1 2 3 4 5 6 7 8 9 # t t t f t t t f t