| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
为什么是WA呢?不明白啊!高手请指导一下撒!#include<stdio.h>
int main()
{
int n,i,j,a[34][34],x,y;
double b[34][34];
char c;
while(scanf("%d%*c",&n)==1)
{
if(n==-1) break;
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
scanf("%c",&c);
b[i][j]=0.0;
a[i][j]=c-'0';
}
scanf("%*c");
}
b[0][0]=1.0;
for(i=0;i<n;i++)
for(j=0;j<n;j++)
{
if(i==n-1&&j==n-1) break;
if(a[i][j]==0) {b[i][j]=0;continue;}
x=i;y=j;
x+=a[i][j];
if(x<n) b[x][j]+=b[i][j];
y+=a[i][j];
if(y<n) b[i][y]+=b[i][j];
}
printf("%.0f\n",b[n-1][n-1]);
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator