結果

問題 No.380 悪の台本
ユーザー simansiman
提出日時 2022-07-21 13:22:21
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 557 bytes
コンパイル時間 309 ms
コンパイル使用メモリ 11,440 KB
実行使用メモリ 15,496 KB
最終ジャッジ日時 2023-09-15 14:51:02
合計ジャッジ時間 1,905 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
15,060 KB
testcase_01 WA -
testcase_02 AC 79 ms
15,076 KB
testcase_03 AC 78 ms
15,128 KB
testcase_04 AC 85 ms
15,496 KB
testcase_05 AC 103 ms
15,224 KB
testcase_06 AC 100 ms
15,252 KB
testcase_07 WA -
testcase_08 AC 80 ms
15,388 KB
testcase_09 AC 94 ms
15,260 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def parse(str)
  name, *words = str.split
  words = words.join(' ').downcase

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

  false
end

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

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