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. Windows,OS X 屏幕录制gif的工具

    gif比png,jpg具有更好的展示效果.github上的很多项目就用gif. 一个比较好的工具是 : http://cockos.com/licecap/    但是目前不支持linux.

  2. Support Library(5)在eclipse中导入SupportXXXDemos

    Support4Demos只用一个v4.,Support7Demos只要v13.jar, SupportAppNavigation只要一个v4.jar. Support7Demos 需要资源全部v7系 ...

  3. leetcode:Search for a Range(数组,二分查找)

    Given a sorted array of integers, find the starting and ending position of a given target value. You ...

  4. sql, plsql 总结

    /* *====================================== basic sql ========================================== */ - ...

  5. ASP.NET26 个常用性能优化方法

    数据库访问性能优化 数据库的连接和关闭 访问数据库资源需要创建连接.打开连接和关闭连接几个操作.这些过程需要多次与数据库交换信息以通过身份验证,比较耗费服务器资源. ASP.NET中提供了连接池(Co ...

  6. poj 1159 (DP LCS)

    滚动数组 + LCS // File Name: 1159.cpp // Author: Missa_Chen // Created Time: 2013年07月08日 星期一 10时07分13秒 # ...

  7. Calculate drive total/free/available space

    using System; using System.Collections.Generic; using System.IO; using System.Text; namespace Consol ...

  8. 【C#学习笔记】Hello World

    using System; namespace ConsoleApplication { class Program { static void Main(string[] args) { Conso ...

  9. php的类型约束

    //如下面的类 class MyClass { /** * 测试函数 * 第一个参数必须为 OtherClass 类的一个对象 */ public function test(OtherClass $ ...

  10. 【英语】Bingo口语笔记(14) - 表示“不愉快”

    bail on 放弃;背弃