結果
| 問題 | No.587 七対子 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2018-04-27 21:15:32 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 700 bytes | 
| コンパイル時間 | 500 ms | 
| コンパイル使用メモリ | 63,360 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-06-27 21:47:14 | 
| 合計ジャッジ時間 | 1,514 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 27 WA * 8 | 
ソースコード
#include<iostream>
using namespace std;
int main(){
    int A[26] = {};
    int pairs = 0;
    char c;
    for(; cin >> c;){
        int index = (int)(c - 'a');
        A[index]++;
        if(A[index] == 2){
            pairs++;
        }else if (A[index] > 2){
            cout << "Impossible" << endl;
            return 0;
        }
    }
    if(pairs == 6){
        for(int i = 0; i < 26; i++){
            if(A[i] == 1){
                cout << (char)('a' + i) << endl;
                return 0;
                // 雑な実装だが与えられた入力制限下では問題ない
            }
        }
    }else{
        cout << "Imopssible" << endl;
        return 0;
    }
   return 0;
}
            
            
            
        