結果

問題 No.548 国士無双
ユーザー toto
提出日時 2025-03-26 11:39:36
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 534 bytes
コンパイル時間 406 ms
コンパイル使用メモリ 28,032 KB
実行使用メモリ 7,328 KB
最終ジャッジ日時 2025-03-26 11:39:37
合計ジャッジ時間 1,466 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2 WA * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 ++){
		int tmp = str[i] - 'a';
		type[tmp]++;
	}
	
	int yaku2 = 0;
	int yaku = 0;
	
	for(int i = 0;i < 13;i ++){
		if(type[i] == 0){
			yaku2++;
		}else if(type[i] == 1){
			yaku++;
		}
	}
	
	if(yaku2 == 13){
		for(int i = 0;i < 13;i ++){
			printf("%c",'a' + i);
		}
	}else if(yaku == 1){
		for(int i = 0;i < 13;i ++){
			if(type[i] == 0){
				printf("%c",'a' + i);
				return 0;
			}
		}
	}else{
		printf("Impossible");
	}
}
0