NBUT 1223 Friends number 2010辽宁省赛

时间:2022-09-29 17:22:29

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. 模拟实现SQL Server中的datepart&lpar;week&comma;date&rpar;的功能

    本文目录列表: 1.为什么要模拟实现datepart(week,date)的功能 2.具体实现思路 3.T-SQL代码实现逻辑 4.总结语 5.参考清单列表   1.为什么要模拟实现datepart( ...

  2. 使用PPT绘制96孔板

    什么?96孔板就是Ctrl+C然后再Ctrl+V? 那你用PPT给我画一个384孔板吧……(学生物的应该都知道这货吧?示意图不少用吧?) 还不够麻烦?那就试试基因芯片吧…… 疯掉了有木有? 那么,看看 ...

  3. python中的 &commat; 修饰符

    今天学习廖老师的python教程,碰到了修饰符'@',不太了解,查看了下官方文档. 简单的整理下: @dec2 @dec1 def func(arg1, arg2, ...): pass 等价于 de ...

  4. debian7编译内核

    第一个步骤“配置内核”. 在这里,我比较建议在发行版默认的config的基础上再进行配置,这样 配置出的内核和发行版本身才会有更好的相容性.比如可以在运行“make menuconfig”之前执行命令 ...

  5. 学习动态性能表 v&dollar;sql

    学习动态性能表 第三篇-(1)-v$sql V$SQL中存储具体的SQL语句. 一条语句可以映射多个cursor,因为对象所指的cursor可以有不同用户(如例1).如果有多个cursor(子游标)存 ...

  6. 应用在安卓和ios端APP的证件识别

    移动端证件识别智能图文处理,是利用OCR识别技术,通过手机拍摄身份证图像或者从手机相册中加载证件图像,过滤身份证的背景底纹干扰,自动分析证件各文字进行字符切分.识别,最后将识别结果按姓名.地址.民族. ...

  7. 使用 Google

    非原版 Glgoo:http://www.glgoo.com/谷粉搜搜:http://www.gfsoso.net/谷粉搜搜:http://www.gfsswy.com/谷粉搜搜:http://guf ...

  8. 【BZOJ3894】【Luogu3358】文理分科 - 最小割多选一模型

    链接Click Here 这个题就是个板子的最小割多选一模型啦\(QwQ\),这里介绍一种通用的解法. 抛开组合收益不谈,这个题就是一个简单的最小割模型.我们只需要建出来这样一张图,在上面跑最小割,割 ...

  9. 【转载并整理】javaweb单点登录

    很好的一篇,讲述原理的文章: http://www.importnew.com/22863.html https://www.cnblogs.com/Leo_wl/p/6111623.html 京东s ...

  10. 【Python-虫师】自动化测试模型--参数化

    一.自动化测试代码最开始是线性的,后续发展为模块化代码,所以涉及到了函数和方法的引用. 1. 函数和方法的最主要区别: Python的方法中定义函数的时候,函数中必须写self.而单独定义函数的时候则 ...