結果

問題 No.8081 HQ9+
ユーザー pockyny
提出日時 2021-04-01 21:21:21
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 354 bytes
コンパイル時間 531 ms
コンパイル使用メモリ 66,664 KB
最終ジャッジ日時 2025-01-20 06:26:25
ジャッジサーバーID
(参考情報)
judge5 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>

using namespace std;
int main(){
    int i,n; cin >> n;
    string s; cin >> s;
    int cnt = 0;
    for(i=0;i<n;i++){
        if(s[i]=='H'){
            cout << -1 << endl;
            return 0;
        }
        if(s[i]=='Q') cnt++;
    }
    if(cnt>=2 || cnt==0) cout << -1 << endl;
    else cout << s << endl;
}
0