結果
問題 | No.587 七対子 |
ユーザー |
|
提出日時 | 2017-11-03 23:02:02 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 533 bytes |
コンパイル時間 | 1,719 ms |
コンパイル使用メモリ | 167,816 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-19 19:43:52 |
合計ジャッジ時間 | 2,672 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 35 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ string S; cin >> S; vector<int> freq(26, 0); for (char c : S){ ++freq[c - 'a']; } int c = 0; char t = '*'; for (int i = 0; i < 26; ++i){ if (freq[i] == 1) { ++c; t = 'a' + i; }else if (freq[i] >= 3){ cout << "Impossible" << endl; return 0; }; } if (c > 1){ cout << "Impossible" << endl; }else{ cout << t << endl; } return 0; }