結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
15,068 KB
testcase_01 AC 78 ms
15,324 KB
testcase_02 AC 78 ms
15,180 KB
testcase_03 AC 79 ms
15,196 KB
testcase_04 AC 87 ms
15,548 KB
testcase_05 AC 104 ms
15,236 KB
testcase_06 AC 101 ms
15,308 KB
testcase_07 AC 242 ms
15,204 KB
testcase_08 AC 77 ms
15,488 KB
testcase_09 AC 92 ms
15,352 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def parse(str)
  return false if str[0] == ' '

  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
  if parse(row)
    puts "CORRECT (maybe)"
  else
    puts "WRONG!"
  end
end
0