結果

問題 No.587 七対子
コンテスト
ユーザー Haijinn
提出日時 2018-02-08 17:42:34
言語 C11(gcc12 gnu拡張)
(gcc 12.4.0)
コンパイル:
gcc-12 -O2 -std=gnu11 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 622 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 120 ms
コンパイル使用メモリ 32,520 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2026-03-08 16:15:59
合計ジャッジ時間 760 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:13:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |         scanf("%s",s);
      |         ^~~~~~~~~~~~~

ソースコード

diff #
raw source code

#include <stdio.h>
#include <string.h>
int main(void)
{
	char s[20];
	int i,j;
	int x[20];
	int c=0;
	int q=0;
	int a=0;
	int l;
	char temp;
	scanf("%s",s);
	l=strlen(s);
	for(i=0;i<l;i++){
		for(j=0;j<l;j++){
			
			if(s[i]==s[j]){
				
				
				
				c++;
				
				
				
				
				
			}
		}
		x[i]=c;
		c=0;
	}
	for(i=0;i<l;i++){
		
		if(x[i]%2!=0&&x[i]<3){
			
			
			q++;
			temp=s[i];
			//printf("%d%c\n",x[i],temp);
			
		}
		if(x[i]>3){
			
			a++;
			
			
		}
		/*if(l-1==i&&q==1){
			
			
			prin
			
		}*/
	}
	if(q==1&&a==0){
		printf("%c\n",temp);
		
		
		
	}else{
		
		printf("Impossible\n");
		
	}
	return 0;
}
0