結果

問題 No.380 悪の台本
ユーザー TatamoTatamo
提出日時 2016-07-05 18:52:02
言語 Python2
(2.7.18)
結果
AC  
実行時間 205 ms / 1,000 ms
コード長 1,418 bytes
コンパイル時間 44 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 7,168 KB
最終ジャッジ日時 2024-04-24 14:40:28
合計ジャッジ時間 908 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
6,144 KB
testcase_01 AC 9 ms
6,144 KB
testcase_02 AC 9 ms
6,272 KB
testcase_03 AC 9 ms
6,272 KB
testcase_04 AC 15 ms
6,528 KB
testcase_05 AC 44 ms
6,784 KB
testcase_06 AC 34 ms
6,784 KB
testcase_07 AC 205 ms
7,168 KB
testcase_08 AC 11 ms
6,528 KB
testcase_09 AC 17 ms
6,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import re
script = sys.stdin.readlines()

rule = {
    "digi":  "nyo",
    "petit": "nyu",
    "rabi": "",
    "gema": "gema",
    "piyo": "pyo"
}

not_kigou_re = re.compile("[0-9a-zA-Z]")

wrong = "WRONG!"
correct = "CORRECT (maybe)"

for line in script :
    line = line.rstrip("\n")
    flg = False
    for chara in rule :
        gobi = rule[chara]
        if(line.startswith(chara)) :
            flg = True
            line = line[len(chara):]
            if(len(line) == 0 or line[0] != " "):
                flg = False
                break
            #print "chara:",chara,"gobi:",gobi
            #print "line:" ,line
            #print "usiro:" ,line[:3+len(gobi)]
            if(chara == "rabi") :
                if(not_kigou_re.search(line) == None):
                    print wrong
                else:
                    print correct
            else :
                flg2 = False
                for x in range(4):
                    if(gobi == line[(len(gobi))*-1:].lower()):
                        flg2 = True
                        print correct
                        break
                    else:
                        if(not_kigou_re.match(line[-1:]) == None):
                            line = line[:-1]
                        else :
                            break
                if(not flg2):
                    print wrong
    if(not flg):
        print wrong
0