結果
問題 |
No.380 悪の台本
|
ユーザー |
|
提出日時 | 2016-06-17 23:45:40 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,322 bytes |
コンパイル時間 | 249 ms |
コンパイル使用メモリ | 12,928 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-11-06 22:44:37 |
合計ジャッジ時間 | 1,327 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 1 |
other | AC * 3 WA * 5 |
ソースコード
import sys def solve(line): name = line[:5] if name == 'digi ': return ends_with(line[5:], 'nyo') elif name == 'petit': return ends_with(line[6:], 'nyu') elif name == 'rabi ': return solve_rabi(line[5:]) elif name == 'gema ': return ends_with(line[5:], 'gema') elif name == 'piyo ': return ends_with(line[5:], 'pyo') else: return False def ends_with(line, txt): n = len(line) if n < len(txt): return False if line.endswith(txt): return True elif n >= 1 and is_symbol(line[-1]): if line[:-1].endswith(txt): return True elif n >= 2 and is_symbol(line[-2]): if line[:-2].endswith(txt): return True elif n >= 3 and is_symbol(line[-3]): if line[:-3].endswith(txt): return True return False def is_symbol(char): ordc = ord(char) if 48 <= ordc <= 57 or 65 <= ordc <= 90 or 97 <= ordc <= 122: return False return True def solve_rabi(line): for c in line: if is_symbol(c): return True return False if __name__ == '__main__': for line in sys.stdin: if solve(line.strip()): print('CORRECT (maybe)') else: print('WRONG!')