ZOJ 3622 Magic Number 水题

#include <set>
#include <map>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <iostream>
#include <algorithm>
using namespace std;
int max(int a,int b){return a<b?b:a;}
int min(int a,int b){return a>b?b:a;}
long long x[55]={
1,2,5,10,20,25,50,
100,125,200,250,500,
1000,1250,2000,2500,5000,
10000,12500,20000,25000,50000,
100000,125000,200000,250000,500000,
1000000,1250000,2000000,2500000,5000000,
10000000,12500000,20000000, 25000000, 50000000,
100000000 ,125000000, 200000000, 250000000, 500000000,
1000000000 ,1250000000, 2000000000, 2500000000,5000000000,
10000000000 ,12500000000, 20000000000};
int main()
{
    long long n,a,b,i;
    while(scanf("%lld%lld",&a,&b)!=EOF)
	{
        n=0;
        for(i=0;i<54;i++)
		{
            if(x[i]>=a&&x[i]<=b)
                n++;
            if(x[i]>b)
				break;
        }
        printf("%lld\n",n);
    }
    return 0;
}

形如AB的数,求出n,m之间满足AB%B==0 数

找出规律后暴力枚举

转载于:https://www.cnblogs.com/Felix-F/archive/2012/12/22/3223645.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值