SCAU 13校赛 17115 ooxx numbers
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的更多相关文章
- 17115 ooxx numbers 交表
17115 ooxx numbers 时间限制:1000MS 内存限制:65535K提交次数:0 通过次数:0 题型: 编程题 语言: G++;GCC Description a number ...
- SCAU 07校赛 10317 Fans of Footbal Teams
10317 Fans of Footbal Teams 时间限制:1000MS 内存限制:65535K 题型: 编程题 语言: 无限制 Description Two famous footba ...
- SCNU省选校赛第二场B题题解
今晚的校赛又告一段落啦,终于"开斋"了! AC了两题,还算是满意的,英语还是硬伤. 来看题目吧! B. Array time limit per test 2 seconds me ...
- 2014上半年acm总结(1)(入门+校赛)
大一下学期才开始了acm,不得不说有一点迟,但是acm确实使我的生活充实了很多,,不至于像以前一样经常没事干= = 上学期的颓废使我的c语言学的渣的一笔..靠考前突击才基本掌握了语法 寒假突然醒悟, ...
- HZNU第十二届校赛赛后补题
愉快的校赛翻皮水! 题解 A 温暖的签到,注意用gets #include <map> #include <set> #include <ctime> #inclu ...
- 2014哈商大ICPC/ACM校赛解题报告
被debug邀请去參加校赛,哎,被虐..我对不起工大.. 由于本人不搞ACM,算法处于HelloWorld水准.. 虽然题目除了鸟不拉屎星人之外都非常水,但我能做到这个程度,全然是超水平发挥了.. 数 ...
- 2015 GDUT校赛
周末打了个GDUT的校赛,也是作为SCAU的一场个人排位. 比赛中竟然卡了个特判,1个半钟就切了5条了,然后一直卡. 还有其他两条可以做的题也没法做了,性格太执着对ACM来说也是错呀. 讲回正题 . ...
- 2016 华南师大ACM校赛 SCNUCPC 非官方题解
我要举报本次校赛出题人的消极出题!!! 官方题解请戳:http://3.scnuacm2015.sinaapp.com/?p=89(其实就是一堆代码没有题解) A. 树链剖分数据结构板题 题目大意:我 ...
- 2017CUIT校赛-线上赛
2017Pwnhub杯-CUIT校赛 这是CUIT第十三届校赛啦,也是我参加的第一次校赛. 在被虐到崩溃的过程中也学到了一些东西. 这次比赛是从5.27早上十点打到5.28晚上十点,共36小时,中间睡 ...
随机推荐
- 收藏一些python的小技能
例子1:For .. else 语法 foo=[2,1] for i in foo: if i == 0: break else: print("i was never 0") 例 ...
- ArrayAdapter参数的不同运用
ArrayAdapter参数不同带来的效果不同 String[] array = {"a","b","c","d",&q ...
- Intent Flag介绍 intent.addFlags()
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); FLAG_ACTIVITY_BROUGHT_TO_FRONT 这个标志一般不是由程序代码设置的 ...
- eclipse有生成不带参数的构造方法的快捷键吗
你打上类名的2个字母,然后”alt“ +“/” 基本上选第一个就行了
- 函数lock_rec_create
/*********************************************************************//** Creates a new record lock ...
- HTML5_智能表单
1.HTML5中为了方便排版,可以使from中的表单标签脱离from的嵌套.方法:from指定ID,所有表单标签均添加from=id属性. <form action="http://l ...
- java读取Properties文件
方法一.通过java.util.Properties读取 Properties p=new Properties(); //p需要InputStream对象进行读取文件,而获取InputStream有 ...
- UVa 839 (递归方式读取二叉树) Not so Mobile
题意: 递归的方式输入一个树状天平(一个天平下面挂的不一定是砝码还可能是一个子天平),判断这个天平是否能满足平衡条件,即W1 * D1 == W2 * D2. 递归的方式处理输入数据感觉很巧妙,我虽然 ...
- 博客已搬家至 hate13.com
博客园停止更新,新博客链接:hate13.com 欢迎访问~
- codevs 1138 聪明的质监员
二分+前缀和. #include<iostream> #include<cstdio> #include<cstring> #include<cmath> ...