結果
問題 | No.43 野球の試合 |
ユーザー | testestest |
提出日時 | 2015-08-10 13:46:03 |
言語 | C90 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 663 bytes |
コンパイル時間 | 330 ms |
コンパイル使用メモリ | 22,400 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-18 06:29:10 |
合計ジャッジ時間 | 653 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
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,940 KB |
testcase_10 | WA | - |
コンパイルメッセージ
main.c: In function ‘x’: main.c:13:1: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration] 13 | printf("%d%d",i,j); | ^~~~~~ main.c:2:1: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’ 1 | #include<string.h> +++ |+#include <stdio.h> 2 | main.c:13:1: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch] 13 | printf("%d%d",i,j); | ^~~~~~ main.c:13:1: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’ main.c: In function ‘main’: main.c:21:1: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration] 21 | scanf("%d\n",&n); | ^~~~~ main.c:21:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’ main.c:21:1: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch] main.c:21:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’ main.c:23:25: warning: implicit declaration of function ‘getchar’ [-Wimplicit-function-declaration] 23 | for(j=0;j<n;j++)a[i][j]=getchar(),a[i][j]-'-'||t++; | ^~~~~~~ main.c:23:25: note: ‘getchar’ is defined in header ‘<stdio.h>’; did you forget to ‘#include <stdio.h>’? main.c:27:1: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch] 27 | printf("%d",x(a,n,t)); | ^~~~~~ main.c:27: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=-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); 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; }