| ||||||||||
| 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 | |||||||||
Re:1001为什么我在自己电脑测试正确,而它总说我wrong answer呢In Reply To:1001 为什么我总是wrong answer请大虾指点 Posted by:fujin at 2008-04-05 10:01:42 #include <stdio.h>
void main()
{
int a[6][10],n[6],x[150],y[150];
int i,j,k,l,point[6];
for(i=0;i<1;i++)
{
for(j=0;j<10;j++) {a[i][j]=getchar();a[i][j]=a[i][j]-48;}
if(a[i][7]!=-16) n[i]=a[i][7]*10+a[i][8];
else n[i]=a[i][8];
if(a[i][1]==-2) {point[i]=4*n[i];for(k=1;k<5;k++) a[i][k]=a[i][k+1];}
else {point[i]=3*n[i];for(k=2;k<5;k++) a[i][k]=a[i][k+1];}
}
for(i=0;i<1;i++)
{
for(j=0;j<5;j++) {x[j]=a[i][j];y[j]=0;}
for(l=2;l<=n[i];l++)
{
for(j=4;j>=0;j--)
{
for(k=(l-1)*5-1;k>=0;k--)
{
y[1+k+j]=a[i][j]*x[k]+y[1+k+j];
}
y[0]=0;
}
for(j=l*5-1;j>0;j--)
{
y[j-1]=y[j]/10+y[j-1];
x[j]=y[j]%10;
}
x[0]=y[0];
for(j=0;j<l*5;j++) y[j]=0;
}
j=0;
for(l=0;l<n[i]*5-point[i];l++)
{
if(x[l]!=0||j==1) {printf("%d",x[l]);j=1;}
}
j=0;
for(l=n[i]*5-1;l>=n[i]*5-point[i];l--)
{
if(x[l]==0) j=j+1;
else break;
}
if(j!=point[i]) printf(".");
for(l=n[i]*5-point[i];l<n[i]*5-j;l++) printf("%d",x[l]);
printf("\n");
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator