結果

問題 No.380 悪の台本
ユーザー koba-e964koba-e964
提出日時 2016-12-06 20:28:59
言語 Ruby
(3.3.0)
結果
RE  
実行時間 -
コード長 661 bytes
コンパイル時間 42 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-04-24 14:51:58
合計ジャッジ時間 1,598 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 WA -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 WA -
testcase_08 RE -
testcase_09 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def search(s, t)
  for i in 0 .. 3
    if s[-t.size-i..-1-i] == t
      return true
    end
  end
  false
end


while s = gets.chomp
  if s == ""
    exit 0
  end
  ok = false
  if s[0..4] == "digi "
    ok = search(s.downcase, "nyo")
  end
  if s[0..5] == "petit "
    ok = search(s.downcase, "nyu")
  end
  if s[0..4] == "gema "
    ok = search(s.downcase, "gema")
  end
  if s[0..4] == "piyo "
    ok = search(s[5..-1].downcase, "pyo")
  end
  if s[0..4] == "rabi "
    t = s[5..-1].downcase
    for k in t
      if ('0' <= k && k <= '9') || ('a' <= k && k <= 'z')
        ok = true
      end
    end
  end
  puts (ok ? "CORRECT (maybe)" : "WRONG!")
end

  
0