結果

問題 No.548 国士無双
コンテスト
ユーザー toto
提出日時 2025-03-25 14:37:41
言語 C++17
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 757 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 90 ms
コンパイル使用メモリ 42,200 KB
実行使用メモリ 9,284 KB
最終ジャッジ日時 2026-07-07 21:29:45
合計ジャッジ時間 1,398 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2 WA * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <stdio.h>

int main(){
	// 文字列
	char str[13];
	scanf("%s",str);
	
	// 数値変換したaからmの配列
	int type[13];
	for(int i = 0;i < 13;i ++){
		type[i] = i + 97;
	}
	// aからmがそれぞれ何個あるか
	int num[13];
	for(int i = 0;i < 13;i ++){
		for(int j = 0;j < 13;j ++){
			if((int)str[i] == type[j]){
				num[j]++;
			}	
		}
	}
	
	int count = 0;
	for(int i = 0;i < 13;i ++){
		if(num[i] > 2){
			printf("Impossible");
			return 0;
		}else if(num[i] == 2){
			count++;
		}
	}
	if(count > 1){
		printf("Impossible");
	}else if(count == 1){
		for(int i = 0;i < 13;i ++){
			if(num[i] == 0){
				printf("%c",str[i]);
				return 0;
			}
		}
	}else if(count == 0){
		for(int i = 0;i < 13;i ++){
			printf("%c\n",str[i]);
		}
	}
}
0