Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
Register

## 同样的代码 long long WA __int64 AC

Posted by 20055106 at 2007-08-20 14:47:34 on Problem 2282
```__int64
#include "stdio.h"
__int64 a[11];
void search(int x)
{
__int64 i,k,j,l;
for(i=0;i<=9;i++)
a[i]=0;
k=1;
while(x>=k)
{
k*=10;
for(i=0;i<=9;i++)
a[i]+=(x/k)*(k/10);
a[0]-=k/10;
j=x%(k/10);
l=(x%k)/(k/10);
for(i=0;i<l;i++)
a[i]+=(k/10);
a[l]+=j+1;
}
}
int main()
{
__int64 m,tt,n,i,t[11];
while(scanf("%I64d%I64d",&m,&n)==2)
{
if(m==0&&n==0)
break;
if(m>n)
{
tt=n;
n=m;
m=tt;
}
search(n);
for(i=0;i<=9;i++)
t[i]=a[i];
search(m-1);
for(i=0;i<=9;i++)
t[i]-=a[i];
for(i=0;i<=9;i++)
{
if(i!=0)
printf(" ");
printf("%I64d",t[i]);
}
printf("\n");
}
return 0;
}
long long
#include "stdio.h"
long long a[11];
void search(int x)
{
long long i,k,j,l;
for(i=0;i<=9;i++)
a[i]=0;
k=1;
while(x>=k)
{
k*=10;
for(i=0;i<=9;i++)
a[i]+=(x/k)*(k/10);
a[0]-=k/10;
j=x%(k/10);
l=(x%k)/(k/10);
for(i=0;i<l;i++)
a[i]+=(k/10);
a[l]+=j+1;
}
}
int main()
{
long long m,tt,n,i,t[11];
while(scanf("%lld%lld",&m,&n)==2)
{
if(m==0&&n==0)
break;
if(m>n)
{
tt=n;
n=m;
m=tt;
}
search(n);
for(i=0;i<=9;i++)
t[i]=a[i];
search(m-1);
for(i=0;i<=9;i++)
t[i]-=a[i];
for(i=0;i<=9;i++)
{
if(i!=0)
printf(" ");
printf("%lld",t[i]);
}
printf("\n");
}
return 0;
}

```

Followed by: