結果

問題 No.2925 2-Letter Shiritori
ユーザー toshiro_yanagi
提出日時 2025-05-10 15:00:13
言語 Ruby
(3.4.1)
結果
TLE  
実行時間 -
コード長 428 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 8,104 KB
実行使用メモリ 41,728 KB
最終ジャッジ日時 2025-05-10 15:00:20
合計ジャッジ時間 7,223 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample TLE * 1 -- * 1
other -- * 10
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

require "set"

class Start
  def main
    _ = input
    puts "? aa"
    s = Set["aa"]

    while true
      x = input.split[1]
      break if x.include?("WIN")
      if x[0] != "a" || s.include?(x)
        _ = input
        break
      end
      t = x[-1] + "a"
      s.add x
      s.add t
      echo "? #{t}"
    end
  end

  protected

  def echo(*x)
    print(*x)
    puts
  end

  def input = gets.chomp
end

Start.new.main
0