結果
問題 | No.548 国士無双 |
ユーザー | takiteke |
提出日時 | 2017-07-28 22:56:34 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.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 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,816 KB |
testcase_01 | AC | 2 ms
6,940 KB |
testcase_02 | AC | 2 ms
6,944 KB |
testcase_03 | AC | 1 ms
6,940 KB |
testcase_04 | AC | 2 ms
6,940 KB |
testcase_05 | AC | 2 ms
6,940 KB |
testcase_06 | AC | 1 ms
6,940 KB |
testcase_07 | AC | 2 ms
6,940 KB |
testcase_08 | AC | 2 ms
6,944 KB |
testcase_09 | AC | 2 ms
6,940 KB |
testcase_10 | AC | 2 ms
6,940 KB |
testcase_11 | AC | 1 ms
6,944 KB |
testcase_12 | AC | 2 ms
6,940 KB |
testcase_13 | AC | 2 ms
6,940 KB |
testcase_14 | AC | 1 ms
6,940 KB |
testcase_15 | AC | 2 ms
6,940 KB |
testcase_16 | AC | 1 ms
6,944 KB |
testcase_17 | AC | 2 ms
6,940 KB |
testcase_18 | AC | 1 ms
6,944 KB |
testcase_19 | AC | 2 ms
6,940 KB |
testcase_20 | AC | 2 ms
6,944 KB |
testcase_21 | AC | 1 ms
6,940 KB |
testcase_22 | AC | 2 ms
6,940 KB |
testcase_23 | AC | 1 ms
6,940 KB |
ソースコード
#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; }