結果
問題 |
No.3081 Make Palindromic Multiple
|
ユーザー |
![]() |
提出日時 | 2025-06-12 18:20:02 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,109 bytes |
コンパイル時間 | 355 ms |
コンパイル使用メモリ | 82,204 KB |
実行使用メモリ | 67,144 KB |
最終ジャッジ日時 | 2025-06-12 18:20:26 |
合計ジャッジ時間 | 12,063 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 3 |
other | RE * 54 |
ソースコード
def generate_99_bottles(): s = [] for i in range(99, 0, -1): line1 = f"{i} bottle{'s' if i != 1 else ''} of beer on the wall, {i} bottle{'s' if i != 1 else ''} of beer." line2 = f"Take one down and pass it around, {i-1} bottle{'s' if (i-1) != 1 else ''} of beer on the wall." s.append(line1) s.append(line2) s.append("") s.append("No more bottles of beer on the wall, no more bottles of beer.") s.append("Go to the store and buy some more, 99 bottles of beer on the wall.") return '\n'.join(s) n = int(input()) s = input().strip() if s == "Hello, World!": print("H") else: song = generate_99_bottles() if s == song: print("9") else: q_count = s.count('Q') if q_count == 1: valid = True for c in s: if c == 'Q': continue if c in {'H', 'Q', '9'}: valid = False break if valid: print(s) else: print(-1) else: print(-1)