結果
問題 |
No.3081 Make Palindromic Multiple
|
ユーザー |
![]() |
提出日時 | 2025-06-12 18:59:48 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,147 bytes |
コンパイル時間 | 158 ms |
コンパイル使用メモリ | 82,568 KB |
実行使用メモリ | 67,708 KB |
最終ジャッジ日時 | 2025-06-12 19:00:01 |
合計ジャッジ時間 | 11,203 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 3 |
other | RE * 54 |
ソースコード
def generate_99_bottles(): bottles = 99 lines = [] while bottles > 0: lines.append(f"{bottles} bottles of beer on the wall, {bottles} bottles of beer.") lines.append("Take one down and pass it around,") if bottles == 1: lines.append("No more bottles of beer on the wall.") else: lines.append(f"{bottles - 1} bottles of beer on the wall.") lines.append("") # Empty line between verses bottles -= 1 lines.append("No more bottles of beer on the wall, no more bottles of beer.") lines.append("Go to the store and buy some more, 99 bottles of beer on the wall.") return '\n'.join(lines) ninety_nine_bottles = generate_99_bottles() N = int(input()) S = input().strip() if S == "Hello, World!": print("H") elif S == ninety_nine_bottles: print("9") elif len(S) > 0 and S[0] == 'Q': # Check if all characters after the first are not HQ+9 commands valid = True for c in S[1:]: if c in {'H', 'Q', '9', '+'}: valid = False break if valid: print(S) else: print(-1) else: print(-1)