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 |
why Wa???????!!!!!!!!!!!!!!!!! Help me !!!!通过了所有的样例 自己取的特例也都能过 #include<iostream> #include<string.h> using namespace std; int f[10]; int weight,a,b; void Find(int x) { int i,one=x%10,high=x/10; if(x==a-1 || x==b) f[0]+=weight; x/=10; for(i=1;i<=one;i++) f[i]+=weight; while(high) { f[high%10]+=(one+1)*weight; high/=10; } for(i=0;i<10;i++) f[i]+=x*weight; weight*=10; if(x-1>0) Find(x-1); } int main() { int i; while(1) { cin>>a>>b; if(!a && !b) break; if(a>b) swap(a,b); memset(f,0,sizeof(f)); weight=-1; Find(a-1); weight=1; Find(b); for(i=0;i<9;i++) cout<<f[i]<<" "; cout<<f[9]<<endl; } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator