結果

問題 No.587 七対子
ユーザー u-shou-sho
提出日時 2017-11-03 23:33:32
言語 C++11
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 744 bytes
コンパイル時間 492 ms
コンパイル使用メモリ 59,224 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-23 15:03:00
合計ジャッジ時間 1,519 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 28 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
using namespace std;
int main(){
    char S[13];
    for(int i=0; i<13; i++) cin >> S[i];
    sort(S, S+13);
    bool odd=0;
    char ans='\n';
    for(int i=0; i<13; i++){
        if(!odd){
            if(S[i]==S[i+1] && S[i]!=S[i+2]){
                i++;
            }else if(S[i]==S[i+1]){
                ans = 'I';
                break;
            }else{
                ans = S[i];
                odd = 1;
            }
        }else{
            if(S[i]==S[i+1]){
                i++;
            }else{
                ans = 'I';
                break;
            }
        }
    }

    if(ans=='I' || ans=='\0' || ans=='\n')cout<<"Impossible\n";
    else cout<<ans<<endl;

    return 0;
}
0