Magic Number(打表)
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3622
View Code
1 #include<iostream> 2 using namespace std ; 3 long long f[55] = {1,2,5,10,20,25,50,100,125,200,250,500,1000,1250,2000,2500, 4 5000,10000,12500,20000,25000,50000,100000,125000,200000,250000,500000,1000000, 5 1250000,2000000,2500000,5000000,10000000,12500000,20000000, 25000000, 50000000, 6 100000000 ,125000000, 200000000, 250000000, 500000000,1000000000 ,1250000000, 7 2000000000, 2500000000,5000000000,10000000000 ,12500000000, 20000000000}; 8 int main() 9 { 10 long long m, n ; 11 while(cin>>m>>n) 12 { 13 long long num = 0 ; 14 for(long long i=0; i<55; i++) 15 { 16 if(f[i]>=m&&f[i]<=n) 17 num++ ; 18 if(f[i]>n) 19 break ; 20 } 21 cout<<num<<endl ; 22 } 23 return 0 ; 24 }