結果

問題 No.548 国士無双
ユーザー toto
提出日時 2025-03-25 14:24:04
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 573 bytes
コンパイル時間 329 ms
コンパイル使用メモリ 27,520 KB
実行使用メモリ 5,888 KB
最終ジャッジ日時 2025-03-25 14:24:06
合計ジャッジ時間 1,331 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1 WA * 23
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:5:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |         scanf("%s",str);
      |         ~~~~~^~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(){
	char str[13];
	scanf("%s",str);
	
	int type[13];
	for(int i = 0;i < 13;i ++){
		type[i] = i + 97;
	}
	
	int num[13];
	for(int i = 0;i < 13;i ++){
		if((int)str[i] == type[i]){
			num[i]++;
		}
	}
	int count = 0;
	char ans[1];
	for(int i = 0;i < 13;i ++){
		if(num[i] > 1){
			printf("Impossible");
			return 0;
		}else if(num[i] == 1){
			count++;
			ans[0] = str[i];
		}
	}
	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;
			}
		}
	}
}
0