結果
問題 |
No.587 七対子
|
ユーザー |
|
提出日時 | 2018-04-27 21:17:52 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 700 bytes |
コンパイル時間 | 522 ms |
コンパイル使用メモリ | 63,968 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-19 19:52:59 |
合計ジャッジ時間 | 1,548 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 35 |
ソースコード
#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 << "Impossible" << endl; return 0; } return 0; }