ソースコード 拡げる

Copy
```#include<stdio.h>
#include<stdlib.h>
#ifndef max
#define max(a,b) (a) > (b) ? (a) : (b)
#endif
#define INF -9999999
void swap(int *a,int *b){
int *tmp;
tmp=a;
a=b;
b=tmp;
}
short int a[1024][1024][512];
int r,c,i,j,maxP=INF;

int maxT(int n,int p,int q){
if(n==0){
if(maxP<a[p][q][n]){
maxP=a[p][q][n];
a[p][q][n]=maxP;
//printf("maxP=%d\n",maxP);
}
return a[p][q][n];
}
if(a[p][q][n]>0){return a[p][q][n];}
else{
if(p-1>=0)a[p-1][q][n-1]=maxT(n-1,p-1,q);
if(q-1>=0)a[p][q-1][n-1]=maxT(n-1,p,q-1);
if(p+1<r)a[p+1][q][n-1]=maxT(n-1,p+1,q);
if(q+1<c)a[p][q+1][n-1]=maxT(n-1,p,q+1);
}
}

int main(){
int d,k,total;
scanf("%d %d %d",&r,&c,&d);
for(i=0;i<r;i++)for(j=0;j<c;j++){
scanf("%d",&a[i][j][0]);
for(k=1;k<d;k++)a[i][j][k]=0;
}
maxT(d,0,0);
printf("%d\n",maxP);
return 0;
}
```

#### 提出情報

提出日時 2014-05-18 08:22:36+0900 B - 謎の人物X toj210 C (GCC 4.6.4) 0 866 Byte CE

#### コンパイルエラー

```./Main.c: In function ‘main’:
./Main.c:38:3: warning: format ‘%d’ expects argument of type ‘int *’, but argument 2 has type ‘short int *’ [-Wformat]
./Main.c:36:7: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
./Main.c:38:8: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
collect2: ld terminated with signal 9 [Killed]
```