17115 ooxx numbers

时间限制:1000MS  内存限制:65535K

题型: 编程题   语言: 无限制

Description

a number A called oo number of a number B if the sum of all As factor is the number B.
(A,B) is a pair of ooxx numbers if A is the oo number of B and B is the oo number of A.
Now i want to find how many pairs of ooxx numbers in [1,n]

输入格式

there are many cases in the input.
for each line there is a number n. ( 1 <= n <= 5000000 )

输出格式

for each n, output the numbers of pairs of ooxx numbers in [1,n] 

输入样例

300
1300

输出样例

1
2

提示

hits
220=1+2+4+71+142=284,
284=1+2+4+5+10+11+20+22+44+55+110=220。
220 and 280 is a pair of ooxx numbers.

作者

admin

解题思路

这题是华农13年校赛的其中一题,当初没有过,如果过了就有一等奖了,没想到这题是打表题,没有经验就想不到有这种处理方式,所以还是学到东西了,当时ZF牛打表出了点差错也没有过,回头很快的秒掉了,真的很快,这次重新写的时候还是Wa了,因为处理因子上出了点差错,将可开根的数的因子少算了一个,导致最后打出的表少了一个数据,跪了。还有一个比较傻逼的问题就是,打表就是打表,不用太在乎效率,没想到我连打表都尽量减少其运行的时间,好几个判断的条件,还是不小心折腾了一番,_(:з」∠)_

ZF大神求因子和的方法:筛素数的思维方式筛出因子和,每个i为因子,j为i的倍数,值得借鉴

相比之下自己求因子和的方法,太挫了 -_-||:

 #include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<cmath>
#include<algorithm> using namespace std; int digit[]; int main()
{
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ;
digit[] = ; sort(digit, digit+);
int n;
while(scanf("%d", &n) != EOF)
{
int i = ;
for(; i<=; ++i)
if(digit[i] > n) break;
printf("%d\n", i-);
}
return ;
}

SCAU 13校赛 17115 ooxx numbers的更多相关文章

  1. 17115 ooxx numbers 交表

    17115 ooxx numbers 时间限制:1000MS  内存限制:65535K提交次数:0 通过次数:0 题型: 编程题   语言: G++;GCC Description a number ...

  2. SCAU 07校赛 10317 Fans of Footbal Teams

    10317 Fans of Footbal Teams 时间限制:1000MS  内存限制:65535K 题型: 编程题   语言: 无限制 Description Two famous footba ...

  3. SCNU省选校赛第二场B题题解

    今晚的校赛又告一段落啦,终于"开斋"了! AC了两题,还算是满意的,英语还是硬伤. 来看题目吧! B. Array time limit per test 2 seconds me ...

  4. 2014上半年acm总结(1)(入门+校赛)

    大一下学期才开始了acm,不得不说有一点迟,但是acm确实使我的生活充实了很多,,不至于像以前一样经常没事干=  = 上学期的颓废使我的c语言学的渣的一笔..靠考前突击才基本掌握了语法 寒假突然醒悟, ...

  5. HZNU第十二届校赛赛后补题

    愉快的校赛翻皮水! 题解 A 温暖的签到,注意用gets #include <map> #include <set> #include <ctime> #inclu ...

  6. 2014哈商大ICPC/ACM校赛解题报告

    被debug邀请去參加校赛,哎,被虐..我对不起工大.. 由于本人不搞ACM,算法处于HelloWorld水准.. 虽然题目除了鸟不拉屎星人之外都非常水,但我能做到这个程度,全然是超水平发挥了.. 数 ...

  7. 2015 GDUT校赛

    周末打了个GDUT的校赛,也是作为SCAU的一场个人排位. 比赛中竟然卡了个特判,1个半钟就切了5条了,然后一直卡. 还有其他两条可以做的题也没法做了,性格太执着对ACM来说也是错呀. 讲回正题 . ...

  8. 2016 华南师大ACM校赛 SCNUCPC 非官方题解

    我要举报本次校赛出题人的消极出题!!! 官方题解请戳:http://3.scnuacm2015.sinaapp.com/?p=89(其实就是一堆代码没有题解) A. 树链剖分数据结构板题 题目大意:我 ...

  9. 2017CUIT校赛-线上赛

    2017Pwnhub杯-CUIT校赛 这是CUIT第十三届校赛啦,也是我参加的第一次校赛. 在被虐到崩溃的过程中也学到了一些东西. 这次比赛是从5.27早上十点打到5.28晚上十点,共36小时,中间睡 ...

随机推荐

  1. AOJ - 0009 Prime Number (素数筛法) && AOJ - 0005 (求最大公约数和最小公倍数)

    http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=34870 求n内的素数个数. /* ********************* ...

  2. static_cast 和 dynamic_cast 的区别

    static_cast一般用来将枚举类型转换成整型,或者整型转换成浮点型.也可以用来将指向父类的指针转换成指向子类的指针.做这些转换前,你必须确定要转换的数据确实是目标类型的数据,因为static_c ...

  3. how bootstrap fit into our website design?

    在web相关技术中,HTML代表了content,structure, CSS则负责styling,决定内容是如何展示的,javascript则主要负责interactive, behaviour. ...

  4. 多个MapReduce作业相互依赖时,使用JobControl进行管理

    要处理复杂关系的数据,一个工程里面绝对不止一个MapReduce作业,当有多个MapReduce作业时,       并且每个作业之间有依赖关系,所谓的依赖就是一个作业得到的结果是另外一个作业的输入, ...

  5. source导入错码解决办法

    mysql -uroot -p --default-character-set=utf8 test < D:/bak/1.sql

  6. 【英语】Bingo口语笔记(24) - L的发音技巧

    舌头往上跑

  7. click和onclick的区别

    onclick是绑定事件,click本身是方法作用是触发onclick事件,只要执行了元素的click()方法,下面有个示例,大家可以看看   Html代码 ? 1 2 3 4 5 6 7 8 9 1 ...

  8. nodejs简单层级结构配置文件

    在NodeJS中使用配置文件,有几种比较不错的方案:第一种:文件格式使用json是毋容置疑的好方案.格式标准,易于理解,文件内容读取到内存之后,使用JSON的标准分析函数即可得到配置项.第二种:将配置 ...

  9. K2 Blackpearl开发技术要点(Part2)

    转:http://www.cnblogs.com/dannyli/archive/2012/09/14/2685282.html K2 Blackpearl开发技术要点(Part2)  

  10. EL表达式(胖先生版)

    EL表达式没有指定范围,从最小范围开始 <% pageContext.setAttribute("shxt", "java web"); request. ...