結果

問題 No.587 七対子
ユーザー toto
提出日時 2025-03-25 13:11:58
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 505 bytes
コンパイル時間 350 ms
コンパイル使用メモリ 28,032 KB
実行使用メモリ 7,328 KB
最終ジャッジ日時 2025-03-25 13:12:00
合計ジャッジ時間 2,001 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22 WA * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 arr[26];
	for(int i = 0;i < 26;i ++){
		arr[i] = i + 97;
	}
	
	int record[26];
	for(int i = 0;i < 26;i ++){
		record[i] = 0;
	}
	for(int i = 0;i < 13;i ++){
		for(int j = 0;j < 26;j ++){
			if((int)str[i] == arr[j]){
				record[j]++;
			}
		}
	}
	
	int count = 0;
	char ans[1];
	for(int i = 0;i < 26;i ++){
		if(record[i] != 0 && record[i] != 2){
			count++;
			ans[0] = arr[i];
		}
	}
	
	if(count != 1){
		printf("Impossible");
	}
}
0