結果

問題 No.380 悪の台本
ユーザー TANIGUCHI Kousuke
提出日時 2016-06-24 18:46:59
言語 Ruby
(3.4.1)
結果
WA  
実行時間 -
コード長 676 bytes
コンパイル時間 54 ms
コンパイル使用メモリ 7,296 KB
実行使用メモリ 19,840 KB
最終ジャッジ日時 2024-11-06 23:01:32
合計ジャッジ時間 1,888 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 3 WA * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

# Here your code !
class String
    def normalize
        self.downcase.gsub(/\s/,'Z').gsub(/[^a-zZ]/,'!')
    end
    def digi?
        self =~ /nyo!{0,3}\Z/
    end
    def petit?
        self =~ /nyu!{0,3}\Z/
    end
    def rabi?
        self =~ /[Z!]/
    end
    def gema?
        self =~ /gema!{0,3}\Z/
    end
    def piyo?
        self =~ /pyo!{0,3}\Z/
    end
end

STDIN.each_line do |line|
    unless line.downcase =~ /\A(gema|piyo|rabi|petit|digi)\s(.+)\Z/
        puts "WRONG!"
        next
    end
    
    a, v = line.downcase.chomp.split(' ',2)
    if v.normalize.send("#{a}?".to_sym)
        puts "CORRECT (maybe)"
    else
        puts "WRONG!"
    end
end

0