結果

問題 No.380 悪の台本
ユーザー DoG_peerDoG_peer
提出日時 2016-06-17 23:56:12
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 1,052 bytes
コンパイル時間 235 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 21,632 KB
最終ジャッジ日時 2024-04-24 14:23:44
合計ジャッジ時間 2,074 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

lines = readlines
def correct
  puts "CORRECT (maybe)"
end

def wrong
  puts "WRONG!"
end

lines.each do |l|
  items = l.split
  name = items[0]
  if items.length <= 1
    wrong
    next
  end
  word = items[1..(-1)].join(" ").downcase
  last_word = items[-1].downcase
  case name
  when "digi"
    if word =~ /nyo$/
      correct
    elsif last_word =~ /nyo(.{,3})$/ && $1.gsub("_","") !~ /^\w*$/
      correct
    else
      wrong
    end
  when "petit"
    if word =~ /nyu$/
      correct
    elsif last_word =~ /nyu(.{,3})$/ && $1.gsub("_","") !~ /^\w*$/
      correct
    else
      wrong
    end
  when "rabi"
    word.gsub!("_","")
    if word =~ /\d/
      correct
    else
      wrong
    end
  when "gema"
    if word =~ /gema$/
      correct
    elsif last_word =~ /gema(.{,3})$/ && $1.gsub("_","") !~ /^\w*$/
      correct
    else
      wrong
    end
  when "piyo"
    if word =~ /pyo$/
      correct
    elsif last_word =~ /pyo(.{,3})$/ && $1.gsub("_","") !~ /^\w*$/
      correct
    else
      wrong
    end

  else
    wrong
  end
end
0