結果
| 問題 |
No.587 七対子
|
| コンテスト | |
| ユーザー |
kurenai3110
|
| 提出日時 | 2017-11-03 22:27:49 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 472 bytes |
| コンパイル時間 | 552 ms |
| コンパイル使用メモリ | 61,360 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-19 19:39:39 |
| 合計ジャッジ時間 | 1,572 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 35 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
int A[26];
int main()
{
string S; cin >> S;
for (int i = 0; i < S.size(); i++) {
A[S[i] - 'a']++;
}
int cnt = 0;
int ans = -1;
for (int i = 0; i < 26; i++) {
if (A[i] == 1) {
cnt++;
ans = i;
}
else if (A[i] > 2) {
ans = -1;
cnt = -100;
}
}
if (cnt == 1)cout << char(ans + 'a') << endl;
else cout << "Impossible" << endl;
return 0;
}
kurenai3110