結果

問題 No.548 国士無双
ユーザー takiteketakiteke
提出日時 2017-07-28 22:56:34
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,811 bytes
コンパイル時間 602 ms
コンパイル使用メモリ 73,016 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-17 15:49:19
合計ジャッジ時間 1,503 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 1 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 2 ms
4,348 KB
testcase_23 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0