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. 南阳理工ACM 括号匹配问题,并求出使得括号能够匹配需要新增的最小括号数(括号匹配(二))

    描述 给你一个字符串,里面只包含"(",")","[","]"四种符号,请问你需要至少添加多少个括号才能使这些括号匹配起 ...

  2. [HIHO1039]字符消除(字符串,枚举,模拟)

    题目链接:http://hihocoder.com/problemset/problem/1039 思路:枚举所有字符更新的位置和ABC三种修改方案,之后再模拟消除规则,一步一步去消除.直到无法消除, ...

  3. 在单机Hadoop上面增加Slave

    之前的文章已经介绍了搭建单机Hadoop, HBase, Hive, Spark的方式:link 现在希望在单机的基础上,加一个slave. 首先需要加上信任关系,加信任关系的方式,见前一篇文章:li ...

  4. 13.Object-C--浅谈Foundation框架常用的结构体

    ------- android培训.iOS培训.期待与您交流! ---------- 昨天学习了Foundation框架中常用的结构体,下面我简单的总结一下,如果错误麻烦请留言指正,谢谢! Found ...

  5. POJ 2069 Super Star

    模拟退火. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm& ...

  6. BZOJ 4415 发牌

    线段树就好了啊. 为什么一眼splay啊... 其实splay也能过,但是线段树更方便? #include<iostream> #include<cstdio> #includ ...

  7. acdream 1412 2-3Trees (组合+DP)

    题意:2-3树的每个结点(除了叶子外)有2或3个孩子(分支),假设是一个满2-3树,那么给出叶子的数量,求这样的树有多少棵.(注:有2个孩子的结点视为相同,有3个孩子的结点视为相同,比如倒数第2层有4 ...

  8. C的结构体使用

    C的结构体演示 #include <stdio.h> struct A //建立结构体A { char *name; int s1; struct A *next; }; void mai ...

  9. ecshop 无限分类解析(转)

    对ecshop无限级分类的解析,认真分析后发现真的其算法还是比较精典的其实并不难理解,有举例方便大家理解 function cat_options($spec_cat_id, $arr) { stat ...

  10. C# 编写Windows Service(windows服务程序)【转载】

    [转]http://www.cnblogs.com/bluestorm/p/3510398.html Windows Service简介: 一个Windows服务程序是在Windows操作系统下能完成 ...