結果
| 問題 | No.548 国士無双 |
| コンテスト | |
| ユーザー |
templepmet
|
| 提出日時 | 2017-07-28 22:37:59 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 717 bytes |
| コンパイル時間 | 672 ms |
| コンパイル使用メモリ | 74,504 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-17 13:28:40 |
| 合計ジャッジ時間 | 1,387 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 24 |
ソースコード
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <utility>
#include <functional>
using namespace std;
int main() {
string s;
int cnt[26] = { 0 };
cin >> s;
for (int i = 0; i < 13; ++i) {
cnt[s[i] - 'a']++;
if (cnt[s[i] - 'a'] > 2) {
cout << "Impossible" << endl;
return 0;
}
}
int c = 0;
for (int i = 0; i < 13; ++i) {
if (cnt[i] == 0) {
c++;
}
}
if (c > 1) {
cout << "Impossible" << endl;
return 0;
}
for (int i = 0; i < 13; ++i) {
if (cnt[i] == 0) {
cout << (char)(i + 'a') << endl;
return 0;
}
}
for (int i = 0; i < 13; ++i) {
cout << (char)(i + 'a') << endl;
}
return 0;
}
templepmet