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 |
贴上代码吧 简单的组合数学问题#include<stdio.h> __int64 init(__int64 m) { __int64 sum=0,k=10,k1=1; while(m/k) { sum+=(m/k*k1); if((m/k1)%10 == 0) sum -= (k1 - 1 - m%k1); k*=10; k1*=10; } return sum; } int main() { __int64 m,n,m1,n1; while(scanf("%I64d %I64d",&m,&n)!=EOF) { if(m<0||n<0) break; m--; if(m<0) m1 = -1; else m1 = init(m); n1 = init(n); printf("%I64d\n",n1-m1); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator