BNU Contest 8-28 A

BNU Contest 8-28 A

A. Magic Number

Time Limit: 2000ms
Memory Limit: 32768KB

64-bit integer IO format: %lld     Java class name: Main

A positive number y is called magic number if for every positive integer x it satisfies that put y to the right of x, which will form a new integer z, z mod y = 0.


The input has multiple cases, each case contains two positve integers m, n(1 <= m <= n <= 2^31-1), proceed to the end of file.


For each case, output the total number of magic numbers between m and n(m, n inclusively).

Sample Input

Sample Output

这个题就是找找规律,把满足条件的y都给写出来  就成了这个序列 1 2 5 10 20 25 50 100 125 200 250 500 1000 1250 。。。 可以看到 从第5个数开始 ,每5个数一组,相邻两组相同组内位置的数差10倍  而 2^32最大不超过 10^9所以最多只有 45个数 ,打表就能过




电子邮件地址不会被公开。 必填项已用*标注

15 + 1 =

This site uses Akismet to reduce spam. Learn how your comment data is processed.