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. c++ 指定长度容器元素的拷贝移动(copy_backward)

    #include <iostream> // cout #include <algorithm> // copy_backward #include <vector> ...

  2. Linux 后台进程管理和就几个“Ctrl+”命令 【转载】

    一.后台进程管理命令 fg.bg.jobs.&.ctrl + z.ctrl + c.ctrl + \.ctrl + d1. &加在一个命令的最后,可以把这个命令放到后台执行 ,如gft ...

  3. Codeforces 839B - Game of the Rows

    839B - Game of the Rows 思路:先放4个的,然后再放2个的,最后再放1个的. 代码: #include<bits/stdc++.h> using namespace ...

  4. Object.defineProperty方法 使用

    Object.defineProperty() 方法会直接在一个对象上定义一个新属性,或者修改一个对象的现有属性, 并返回这个对象. 语法: Object.defineProperty(obj, pr ...

  5. LeetCode--191--位1的个数

    问题描述: 编写一个函数,输入是一个无符号整数,返回其二进制表达式中数字位数为 ‘1’ 的个数(也被称为汉明重量). 示例 : 输入: 11 输出: 3 解释: 整数 11 的二进制表示为 00000 ...

  6. Android动画(Animations)

    动画类型Android的animation由四种类型组成 XML中 alpha  : 渐变透明度动画效果 scale  :渐变尺寸伸缩动画效果 translate  : 画面转换位置移动动画效果 ro ...

  7. homestead 暴露接口到外网

    laravel 官方推荐的运行环境是homestead,但homestead是个虚拟机,你自己访问没问题,给别人联调怎么办? 一个大型项目肯定不止一个人开发,这个时候就需要将你虚拟机上的接口暴露给外网 ...

  8. hdu1238 kmp

    You are given a number of case-sensitive strings of alphabetic characters, find the largest string X ...

  9. Java网络编程和NIO详解8:浅析mmap和Direct Buffer

    Java网络编程与NIO详解8:浅析mmap和Direct Buffer 本系列文章首发于我的个人博客:https://h2pl.github.io/ 欢迎阅览我的CSDN专栏:Java网络编程和NI ...

  10. hdu-2227-dp+bit

    Find the nondecreasing subsequences Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/3 ...