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