結果
問題 | No.587 七対子 |
ユーザー |
![]() |
提出日時 | 2017-12-31 17:54:55 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 767 bytes |
コンパイル時間 | 741 ms |
コンパイル使用メモリ | 76,516 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-19 19:49:28 |
合計ジャッジ時間 | 1,801 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 35 |
ソースコード
#include <iostream> #include <algorithm> #include <queue> #include <vector> #include <map> #include <string> using namespace std; void solve(); int main() { cin.tie(0); ios::sync_with_stdio(false); solve(); } void solve() { string s; cin >> s; int count[26]; for(int i = 0; i < 26; i++) { count[i] = 0; } for(int i = 0; i < s.length(); i++) { count[s[i] - 'a']++; } int ind = -1; for(int i = 0; i < 26; i++) { if(count[i] == 1) { if(ind == -1) ind = i; else ind = -2; } if(count[i] != 1 && count[i] != 0 && count[i] != 2) ind = -2; } if(ind == -2 || ind == -1) cout << "Impossible" << endl; else cout << (char)('a' + ind) << endl; }