結果

問題 No.587 七対子
ユーザー naipia
提出日時 2018-05-26 16:28:50
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 481 bytes
コンパイル時間 1,269 ms
コンパイル使用メモリ 161,892 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-28 18:11:59
合計ジャッジ時間 2,482 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 32 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

int main(){
    char ans='1',pre='1';
    string s;
    cin >> s;

    sort(s.begin(),s.end());
    int cnt=0;
    for(int i=0;i<s.size();i++){
        if(s[i]==pre) cnt++;
        else{
            if((ans!='1'&&cnt==1) || cnt>2) ans='0';
            if(cnt==1 && ans=='1') ans=pre;
            cnt=1;
            pre=s[i];
        }
    }
    if(ans!='0') cout << ans << endl;
    else cout << "Impossible" << endl;

    return 0;
}
0