| ||||||||||
| 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 | |||||||||
1001 为什么我总是wrong answer请大虾指点以下是我的代码:
#include<stdio.h>
#include<math.h>
#include<string.h>
# define d 5
void main()
{int h,i,j,k,m,n,r,s,t,u,v=0,w,x,y,z=0,a[151]={0},b[d],c[151];
for(w=d-1;w>=0;w--)
{
y=getchar();
if(y!='.')
c[w]=b[w]=y-48;
else
{
w++;
v=w;
}
}
scanf("%d",&h);
if((n=h)==1)
{ memset(c,0,131);
c[0]=1;
c[1]=0;
c[2]=0;
c[3]=0;
c[4]=0;
}
else
n=h-1;
for(i=1,s=d;i<=n;i++)
{
memset(a,0,131);
for(j=0;j<d;j++)
for(k=0,m=0;k<s;k++,m++)
{
a[m+j]+=(b[j]*c[k])%10;
if(a[m+j]>=10)
{
a[m+j+1]+=a[m+j]/10;
a[m+j]=a[m+j]%10;
}
a[m+j+1]+=(b[j]*c[k])/10;
if(a[m+j+1]>=10)
{
a[m+j+2]+=a[m+j+1]/10;
a[m+j+1]=a[m+j+1]%10;
}
}
for(r=0;r<m+j;r++)
c[r]=a[r];
s=m+j;
}
u=s-1;
while(a[u]==0&&u>v*h-1)
u--;
while(a[z]==0)
z++;
for(t=u;t>=z;t--)
{
if(h==1&&t==v-1)
printf(".");
else
if(t==v*h-1)
printf(".");
printf("%d",a[t]);
}
printf("\n");
}
我试过了 只有0。4321 20 这组数据有问题。。。。
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator