結果
| 問題 |
No.548 国士無双
|
| コンテスト | |
| ユーザー |
takiteke
|
| 提出日時 | 2017-07-28 22:56:34 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,811 bytes |
| コンパイル時間 | 742 ms |
| コンパイル使用メモリ | 73,260 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-17 13:29:39 |
| 合計ジャッジ時間 | 1,181 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 24 |
ソースコード
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
string S;
int table[13] = {};
cin >> S;
int len = S.length();
for (int i = 0;i < len;i++) {
for (int j = 0;j < 13; j++) {
if (S[i] == 'a' + j) {
table[j]++;
}
}
}
int zer = 0;
for (int j = 0; j < 13;j++) {
if (table[j] == 0) zer++;
}
if (zer >= 2) {
cout << "Impossible" << endl;
return 0;
}
for (int j = 0; j < 13;j++) {
if (table[0] == 0) {
cout << "a" << endl; return 0;
}
if (table[1] == 0) {
cout << "b" << endl;return 0;
}
if (table[2] == 0) {
cout << "c" << endl;return 0;
}
if (table[3] == 0) {
cout << "d" << endl;return 0;
}
if (table[4] == 0) {
cout << "e" << endl;return 0;
}
if (table[5] == 0) { cout << "f" << endl;return 0; }
if (table[6] == 0) { cout << "g" << endl;return 0; }
if (table[7] == 0) {cout << "h" << endl;return 0;}
if (table[8] == 0) { cout << "i" << endl;return 0; }
if (table[9] == 0) { cout << "j" << endl;return 0; }
if (table[10] == 0) { cout << "k" << endl;return 0; }
if (table[11] == 0) { cout << "l" << endl;return 0; }
if (table[12] == 0) { cout << "m" << endl;return 0; }
}
if (table[0] == 1) cout << "a" << endl;
if (table[1] == 1) cout << "b" << endl;
if (table[2] == 1) cout << "c" << endl;
if (table[3] == 1) cout << "d" << endl;
if (table[4] == 1) cout << "e" << endl;
if (table[5] == 1) cout << "f" << endl;
if (table[6] == 1) cout << "g" << endl;
if (table[7] == 1) cout << "h" << endl;
if (table[8] == 1) cout << "i" << endl;
if (table[9] == 1) cout << "j" << endl;
if (table[10] == 1) cout << "k" << endl;
if (table[11] == 1) cout << "l" << endl;
if (table[12] == 1) cout << "m" << endl;
return 0;
}
takiteke