結果

問題 No.380 悪の台本
ユーザー simansiman
提出日時 2022-07-21 13:11:48
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 517 bytes
コンパイル時間 500 ms
コンパイル使用メモリ 11,400 KB
実行使用メモリ 15,724 KB
最終ジャッジ日時 2023-09-15 14:36:54
合計ジャッジ時間 2,894 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 77 ms
15,120 KB
testcase_03 AC 77 ms
15,188 KB
testcase_04 AC 84 ms
15,724 KB
testcase_05 AC 97 ms
15,444 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 79 ms
15,584 KB
testcase_09 AC 86 ms
15,352 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def parse(str)
  name, * = str.split

  case name
  when "digi"
    return true if str =~ /nyo[^a-zA-Z0-9]{0,3}$/
  when "petit"
    return true if str =~ /nyu[^a-zA-Z0-9]{0,3}$/
  when "rabi"
    return true if str =~ /[^a-zA-Z0-9]/
  when "gema"
    return true if str =~ /gema[^a-zA-Z0-9]{0,3}$/
  when "piyo"
    return true if str =~ /pyo[^a-zA-Z0-9]{0,3}$/
  end

  false
end

while row = gets&.chomp
  break if row.empty?

  if parse(row.downcase)
    puts "CORRECT (maybe)"
  else
    puts "WRONG!"
  end
end
0