結果

問題 No.380 悪の台本
ユーザー HachimoriHachimori
提出日時 2016-06-17 23:36:59
言語 Python2
(2.7.18)
結果
AC  
実行時間 186 ms / 1,000 ms
コード長 1,035 bytes
コンパイル時間 45 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2024-04-24 14:21:03
合計ジャッジ時間 946 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
6,144 KB
testcase_01 AC 10 ms
6,144 KB
testcase_02 AC 11 ms
6,144 KB
testcase_03 AC 10 ms
6,144 KB
testcase_04 AC 14 ms
6,144 KB
testcase_05 AC 35 ms
6,144 KB
testcase_06 AC 34 ms
6,016 KB
testcase_07 AC 186 ms
5,888 KB
testcase_08 AC 12 ms
6,272 KB
testcase_09 AC 18 ms
6,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python
#coding:utf8

def read():
    return raw_input()


def work(s):
    sList = s.split(' ', 1)
    
    if len(sList) != 2:
        print "WRONG!"
        return
    
    name, sentence = sList[0], sList[1]

    cntSymbol = 0
    while cntSymbol < len(sentence) and not sentence[len(sentence) - 1 - cntSymbol].isalnum():
        cntSymbol += 1
    sentence = sentence[:len(sentence) - cntSymbol]

    if name == "digi":
        isOk = cntSymbol <= 3 and sentence[-3:].upper() == "NYO" 
    elif name == "petit":
        isOk = cntSymbol <= 3 and sentence[-3:].upper() == "NYU"
    elif name == "rabi":
        isOk = len(sentence) > 0
    elif name == "gema":
        isOk = cntSymbol <= 3 and sentence[-4:].upper() == "GEMA"
    elif name == "piyo":
        isOk = cntSymbol <= 3 and sentence[-3:].upper() == "PYO"
    else:
        isOk = False
    
    print "CORRECT (maybe)" if isOk else "WRONG!"


if __name__ == "__main__":
    try:
        while 1:
            work(read())
    except EOFError:
        pass
0