結果
| 問題 |
No.587 七対子
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-11-03 22:30:27 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 548 bytes |
| コンパイル時間 | 712 ms |
| コンパイル使用メモリ | 71,584 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-19 19:41:06 |
| 合計ジャッジ時間 | 1,534 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 35 |
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
int main() {
string s;
cin >> s;
vector<int> cnt(256);
for (char c : s) {
cnt[c]++;
}
char ans;
int uniq = 0;
for (int i = 0; i < 256; i++) {
if (cnt[i] == 1) {
ans = i;
} else if (cnt[i] > 2) {
cout << "Impossible" << endl;
return 0;
}
if (1 <= cnt[i] && cnt[i] <= 2) {
uniq++;
}
}
if (uniq != 7) {
cout << "Impossible" << endl;
return 0;
}
cout << ans << endl;
}