結果

問題 No.587 七対子
ユーザー 👑 CleyL
提出日時 2019-07-07 03:52:45
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 510 bytes
コンパイル時間 457 ms
コンパイル使用メモリ 63,872 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-19 19:59:37
合計ジャッジ時間 1,309 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
int alp[27];
int main(){
    string s;cin>>s;
    for(int i = 0; s.size() > i; i++){
        alp[s[i]-'a']++;
    }
    char ans = 'A';
    for(int i = 0; 27 > i; i++){
        if(alp[i]>2){
            cout << "Impossible" << endl;
            return 0;
        }
        if(alp[i]==1){
            if(ans != 'A'){
                cout << "Impossible" << endl;
                return 0;
            }
            ans = i+'a';
        }
    }
    cout << ans << endl;
}
0