Time limit  1000 ms

Memory limit   131072 kB

Paula and Tai are couple. There are many stories between them. The day Paula left by airplane, Tai send one message to telephone 2200284, then, everything is changing… (The story in “the snow queen”).

After a long time, Tai tells Paula, the number 220 and 284 is a couple of friends number, as they are special, all divisors of 220’s sum is 284, and all divisors of 284’s sum is 220. Can you find out there are how many couples of friends number less than 10,000. Then, how about 100,000, 200,000 and so on.

The task for you is to find out there are how many couples of friends number in given closed interval [a,b]。

Input

There are several cases.
Each test case contains two positive integers a, b(1<= a <= b <=5,000,000).
Proceed to the end of file.


Output

For each test case, output the number of couples in the given range. The output of one test case occupied exactly one line.


Sample Input

1 100
1 1000

Sample Output

0
1

Hint

6 is a number whose sum of all divisors is 6. 6 is not a friend number, these number is called Perfect Number.

暴力打表找出1-5000000的friends number,打表的时候记得先开方,要不然时间会耗得很长,打表得到70+组friends number

代码如下
 #include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int num[][]={
,,
, ,
, ,
, ,
,,
,,
,,
,,
,,
,,
,,
,,
,,
,,
,,
,,
,,
,,
,,
,,
,,
,,
,,
,,
,,
,,
,,
,,
,,
, ,
, ,
,,
, ,
, ,
, ,
, ,
,,
,,
,,
, ,
, ,
, ,
, ,
, ,
,,
,,
, ,
, ,
,,
,,
,,
,,
,,
, ,
, ,
, ,
, ,
,,
,,
,,
,,
, ,
,,
,,
,,
,,
,,
,,
,,
, ,
,,
,,
,,
, }; int main()
{
int a,b;
int i;
int sum;
while(~scanf("%d%d",&a,&b))
{
sum=;
for(i=;i<;i++)
{
if(num[i][]>=a&&num[i][]<=b)
sum++;
if(num[i][]>b)
break;
}
printf("%d\n",sum);
}
return ;
}

NBUT 1223 Friends number 2010辽宁省赛的更多相关文章

  1. NBUT 1224 Happiness Hotel 2010辽宁省赛

    Time limit 1000 ms Memory limit 131072 kB The life of Little A is good, and, he managed to get enoug ...

  2. NBUT 1222 English Game 2010辽宁省赛

    Time limit 1000 ms Memory limit 131072 kB This English game is a simple English words connection gam ...

  3. NBUT 1221 Intermediary 2010辽宁省赛

    Time limit 1000 ms Memory limit 131072 kB It is widely known that any two strangers can get to know ...

  4. NBUT 1225 NEW RDSP MODE I 2010辽宁省赛

    Time limit  1000 ms Memory limit  131072 kB Little A has became fascinated with the game Dota recent ...

  5. NBUT 1220 SPY 2010辽宁省赛

    Time limit  1000 ms Memory limit  131072 kB The National Intelligence Council of X Nation receives a ...

  6. NBUT 1218 You are my brother 2010辽宁省赛

    Time limit 1000 ms Memory limit 131072 kB Little A gets to know a new friend, Little B, recently. On ...

  7. NBUT 1219 Time 2010辽宁省赛

    Time limit   1000 ms Memory limit   131072 kB Digital clock use 4 digits to express time, each digit ...

  8. NBUT 1217 Dinner 2010辽宁省赛

    Time limit  1000 ms Memory limit  32768 kB Little A is one member of ACM team. He had just won the g ...

  9. ZOJ 1985 Largest Rectangle in a Histogram(刷广告)2010辽宁省赛

    Largest Rectangle in a Histogram Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 21204 ...

随机推荐

  1. MyBatis各种类型的入参使用方式

    https://blog.csdn.net/u011983531/article/details/53561219 mybatis中if判断传入字符串或者Long参数不为空 https://blog. ...

  2. HTML5 Plus 拍照或者相册选择图片上传

    HBuilder+HTML5 Plus+MUI实现拍照或者相册选择图片上传,利用HTML5 Plus的Camera.Gallery.IO.Storage和Uploader来实现手机APP拍照或者从相册 ...

  3. Jmeter性能测试之一 性能测试的流程和步骤介绍

    Step1: 知道在架构上,你要做的性能测试要cover几个部分,如下图,性能测试从用户角度,PC端之后都要要考虑进行的,例如网络,app server,Database等等 N1+N2+N3+N4 ...

  4. Log4J日志配置详解[转]

    一.Log4j简介 Log4j有三个主要的组件:Loggers(记录器),Appenders (输出源)和Layouts(布局).这里可简单理解为日志类别,日志要输出的地方和日志以何种形式输出.综合使 ...

  5. box-shadow四周都有阴影

    <style> .shadow{ -webkit-box-shadow: #666 0px 0px 10px; -moz-box-shadow: #666 0px 0px 10px; bo ...

  6. Java下载https文件上传到阿里云oss服务器

    Java下载https文件上传到阿里云oss服务器 今天做了一个从Https链接中下载音频并且上传到OSS服务器,记录一下希望大家也少走弯路. 一共两个类: 1 .实现自己的证书信任管理器类 /** ...

  7. Jmeter JDBC的使用

    1.当我们在对接口进行断言或进行多个接口串联时,常常会需要从DB查询数据来做辅助,连接JDBC需要有支持DB的jar包:官网下载地址:https://dev.mysql.com/downloads/c ...

  8. php-------代码加密的几种方法

    代码加密,也是保护网站安全的一种方法,以下我们来介绍一下如何通过PHP的自定义函数来加密我们的PHP代码. 方法一: <?php function encode_file_contents($f ...

  9. Confluence 6 更新目录

    当编辑目录时候的限制 你不能对你用户属于的目录进行编辑,禁用或者删除.这个能够预防管理员通过修改目录的时候讲自己属于的管理员权限从系统管理员组中删除. 这个限制对所有的用户目录类型适用.例如: 如果当 ...

  10. Trailing Loves (or L'oeufs?) CodeForces - 1114C (数论)

    大意: 求n!在b进制下末尾0的个数 等价于求n!中有多少因子b, 素数分解一下, 再对求出所有素数的最小因子数就好了 ll n, b; vector<pli> A, res; void ...