結果

問題 No.8081 HQ9+
ユーザー aram14
提出日時 2021-04-01 22:57:16
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 669 bytes
コンパイル時間 77 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-12-21 07:02:34
合計ジャッジ時間 1,563 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
S = input()

if 'Hello, World!' in S or '99 bottles of beer on the wall, 99 bottles of beer.' in S:
    n -= S.count('Hello, World!') * (len('Hello, World!')-1)
    S = S.replace('Hello, World!', 'H')
    n -= S.count('99 bottles of beer on the wall, 99 bottles of beer.') * (len('99 bottles of beer on the wall, 99 bottles of beer.')-1)
    S = S.replace('99 bottles of beer on the wall, 99 bottles of beer.', '9')
    if (set(S) == {'H'} or set(S) == {'9'} or set(S) == {'H', '9'} or set(S) == {'9', 'H'}) and len(S) == n:
        print(S)
    else:
        print(-1)
elif 'H' not in S and '9' not in S and 'Q' in S:
    print(S)
else:
    print(-1)
0