結果

問題 No.24 数当てゲーム
ユーザー testestesttestestest
提出日時 2016-04-01 23:17:24
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 2,469 bytes
コンパイル時間 309 ms
コンパイル使用メモリ 22,656 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-02 09:19:27
合計ジャッジ時間 827 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:1:1: warning: data definition has no type or storage class
    1 | a[10],H,B,s,t,i,j;
      | ^
main.c:1:1: warning: type defaults to ‘int’ in declaration of ‘a’ [-Wimplicit-int]
main.c:1:7: warning: type defaults to ‘int’ in declaration of ‘H’ [-Wimplicit-int]
    1 | a[10],H,B,s,t,i,j;
      |       ^
main.c:1:9: warning: type defaults to ‘int’ in declaration of ‘B’ [-Wimplicit-int]
    1 | a[10],H,B,s,t,i,j;
      |         ^
main.c:1:11: warning: type defaults to ‘int’ in declaration of ‘s’ [-Wimplicit-int]
    1 | a[10],H,B,s,t,i,j;
      |           ^
main.c:1:13: warning: type defaults to ‘int’ in declaration of ‘t’ [-Wimplicit-int]
    1 | a[10],H,B,s,t,i,j;
      |             ^
main.c:1:15: warning: type defaults to ‘int’ in declaration of ‘i’ [-Wimplicit-int]
    1 | a[10],H,B,s,t,i,j;
      |               ^
main.c:1:17: warning: type defaults to ‘int’ in declaration of ‘j’ [-Wimplicit-int]
    1 | a[10],H,B,s,t,i,j;
      |                 ^
main.c:2:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
    2 | main(){
      | ^~~~
main.c: In function ‘main’:
main.c:4:17: warning: implicit declaration of function ‘fflush’ [-Wimplicit-function-declaration]
    4 |                 fflush(!printf("0 1 2 %d\n",i));
      |                 ^~~~~~
main.c:4:25: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration]
    4 |                 fflush(!printf("0 1 2 %d\n",i));
      |                         ^~~~~~
main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
  +++ |+#include <stdio.h>
    1 | a[10],H,B,s,t,i,j;
main.c:4:25: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch]
    4 |                 fflush(!printf("0 1 2 %d\n",i));
      |                         ^~~~~~
main.c:4:25: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
main.c:

ソースコード

diff #

a[10],H,B,s,t,i,j;
main(){
	for(i=3;i<10;i++){
		fflush(!printf("0 1 2 %d\n",i));
		scanf("%d%d",&H,&B);
		a[i]=H+B;
	}
	for(i=4;i<10;i++)s|=(a[i]>a[3])<<i;
	if(s==0)for(s=8,i=4;i<10;i++)s|=(a[i]==a[3])<<i;
	for(i=s,t=1;i&=i-1;t++);
	if(t!=4){
		for(i=4;i<10&&s&(1<<i);i++);
		for(j=i+1;j<10&&s&(1<<j);j++);
		printf("0 1 %d %d\n",i,j);scanf("%d%d",&H,&B);s|=(H+B<a[i])<<2;
		printf("0 %d 2 %d\n",i,j);scanf("%d%d",&H,&B);s|=(H+B<a[i])<<1;
		printf("%d 1 2 %d\n",i,j);scanf("%d%d",&H,&B);s|=(H+B<a[i]);
	}
	for(t=i=0;i<10;i++)if(s&(1<<i))a[t++]=i;
	printf("%d %d %d %d\n",a[0],a[1],a[2],a[3]);scanf("%d%*d",&H);if(H==4)exit(0);
	printf("%d %d %d %d\n",a[0],a[1],a[3],a[2]);scanf("%d%*d",&H);if(H==4)exit(0);
	printf("%d %d %d %d\n",a[0],a[2],a[1],a[3]);scanf("%d%*d",&H);if(H==4)exit(0);
	printf("%d %d %d %d\n",a[0],a[2],a[3],a[1]);scanf("%d%*d",&H);if(H==4)exit(0);
	printf("%d %d %d %d\n",a[0],a[3],a[1],a[2]);scanf("%d%*d",&H);if(H==4)exit(0);
	printf("%d %d %d %d\n",a[0],a[3],a[2],a[1]);scanf("%d%*d",&H);if(H==4)exit(0);
	printf("%d %d %d %d\n",a[1],a[0],a[2],a[3]);scanf("%d%*d",&H);if(H==4)exit(0);
	printf("%d %d %d %d\n",a[1],a[0],a[3],a[2]);scanf("%d%*d",&H);if(H==4)exit(0);
	printf("%d %d %d %d\n",a[1],a[2],a[0],a[3]);scanf("%d%*d",&H);if(H==4)exit(0);
	printf("%d %d %d %d\n",a[1],a[2],a[3],a[0]);scanf("%d%*d",&H);if(H==4)exit(0);
	printf("%d %d %d %d\n",a[1],a[3],a[0],a[2]);scanf("%d%*d",&H);if(H==4)exit(0);
	printf("%d %d %d %d\n",a[1],a[3],a[2],a[0]);scanf("%d%*d",&H);if(H==4)exit(0);
	printf("%d %d %d %d\n",a[2],a[0],a[1],a[3]);scanf("%d%*d",&H);if(H==4)exit(0);
	printf("%d %d %d %d\n",a[2],a[0],a[3],a[1]);scanf("%d%*d",&H);if(H==4)exit(0);
	printf("%d %d %d %d\n",a[2],a[1],a[0],a[2]);scanf("%d%*d",&H);if(H==4)exit(0);
	printf("%d %d %d %d\n",a[2],a[1],a[2],a[0]);scanf("%d%*d",&H);if(H==4)exit(0);
	printf("%d %d %d %d\n",a[2],a[3],a[0],a[1]);scanf("%d%*d",&H);if(H==4)exit(0);
	printf("%d %d %d %d\n",a[2],a[3],a[1],a[0]);scanf("%d%*d",&H);if(H==4)exit(0);
	printf("%d %d %d %d\n",a[3],a[0],a[1],a[2]);scanf("%d%*d",&H);if(H==4)exit(0);
	printf("%d %d %d %d\n",a[3],a[0],a[2],a[1]);scanf("%d%*d",&H);if(H==4)exit(0);
	printf("%d %d %d %d\n",a[3],a[1],a[0],a[2]);scanf("%d%*d",&H);if(H==4)exit(0);
	printf("%d %d %d %d\n",a[3],a[1],a[2],a[0]);scanf("%d%*d",&H);if(H==4)exit(0);
	printf("%d %d %d %d\n",a[3],a[2],a[0],a[1]);scanf("%d%*d",&H);if(H==4)exit(0);
	printf("%d %d %d %d\n",a[3],a[2],a[1],a[0]);scanf("%d%*d",&H);if(H==4)exit(0);
}
0