結果
問題 | No.43 野球の試合 |
ユーザー | testestest |
提出日時 | 2015-08-10 13:45:15 |
言語 | C90 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 783 bytes |
コンパイル時間 | 118 ms |
コンパイル使用メモリ | 22,272 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-18 06:29:07 |
合計ジャッジ時間 | 643 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 1 ms
6,944 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | AC | 1 ms
6,944 KB |
testcase_10 | WA | - |
コンパイルメッセージ
main.c: In function ‘x’: main.c:11:17: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration] 11 | for(i=0;i<3;i++)printf("%c%c%c\n",a[i][0],a[i][1],a[i][2]); | ^~~~~~ main.c:2:1: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’ 1 | #include<string.h> +++ |+#include <stdio.h> 2 | main.c:11:17: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch] 11 | for(i=0;i<3;i++)printf("%c%c%c\n",a[i][0],a[i][1],a[i][2]); | ^~~~~~ main.c:11:17: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’ main.c:14:1: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch] 14 | printf("%d%d",i,j); | ^~~~~~ main.c:14:1: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’ main.c: In function ‘main’: main.c:23:1: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration] 23 | scanf("%d\n",&n); | ^~~~~ main.c:23:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’ main.c:23:1: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch] main.c:23:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’ main.c:25:25: warning: implicit declaration of function ‘getchar’ [-Wimplicit-function-declaration] 25 | for(j=0;j<n;j++)a[i][j]=getchar(),a[i][j]-'-'||t++; | ^~~~~~~ main.c:25:25: note: ‘getchar’ is defined in header ‘<stdio.h>’; did you forget to ‘#include <stdio.h>’? main.c:29:1: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch] 29 | printf("%d",x(a,n,t)); | ^~~~~~ main.c:29:1: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
ソースコード
#include<string.h> int x(int a[][7],int n,int t){ int b[6]={},c[7][7]={},i=0,j=0,f=1,w,l; if(t==0){ for(i=0;i<n;i++)for(j=0;j<n;j++)if(a[i][j]=='o')b[i]++; for(i=n;i>2;i--)for(j=2;j<i;j++)if(b[j-1]>b[j])b[j-1]^=b[j]^=b[j-1]^=b[j]; for(i=1;i<n;i++)if(b[i]>b[0]&&b[i-1]!=b[i])f++; return f; } for(i=0;i<3;i++)printf("%c%c%c\n",a[i][0],a[i][1],a[i][2]); for(i=-1;f&&++i<n;)for(j=i;f&&++j<n;)if(a[i][j]=='-')f--; memcpy(c,a,196); printf("%d%d",i,j); c[i][j]='o';c[j][i]='x';w=x(c,n,t-1); for(i=0;i<3;i++)printf("%c%c%c\n",c[i][0],c[i][1],c[i][2]); c[i][j]='x';c[j][i]='o';l=x(c,n,t-1); return w<l?w:l; } int main(){ int n,a[7][7]={},t=0,i,j; scanf("%d\n",&n); for(i=0;i<n;i++){ for(j=0;j<n;j++)a[i][j]=getchar(),a[i][j]-'-'||t++; getchar(); } t/=2; printf("%d",x(a,n,t)); return 0; }