Day7 - I - Semi-prime H-numbers POJ - 3292】的更多相关文章

[POJ 3292] Semi-prime H-numbers 打个表 题意是1 5 9 13...这样的4的n次方+1定义为H-numbers H-numbers中仅仅由1*自己这一种方式组成 即没有其它因子的 叫做H-prime 两个H-prime的乘积叫做H-semi-prime 另一个要求是H-semi-prime仅仅能由两个H-prime组成 即4个H-number 不可由3个或几个H-number构成 筛出来个满足题意的表 把每一个数内满足的个数存起来O(1)输出就可以 代码例如以下…
题意:题目比较容易混淆,要搞清楚一点,这里面所有的定义都是在4×k+1(k>=0)这个封闭的集合而言的,不要跟我们常用的自然数集混淆. 题目要求我们计算 H-semi-primes, H-semi-primes是 两个H-primes的乘积, H-primes的定义为:在这个集合中只能由1和它本来相乘得来,并且1不是 H-primes: 分析:这个题目我一开始是想打表记录一下的,但是没有筛法的效率,数据量过大,程序崩溃了(连超时的机会都不给我),看了多个别人的做法才知道,这个题目考查的是对于素数…
This problem is based on an exercise of David Hilbert, who pedagogically suggested that one study the theory of 4n+1 numbers. Here, we do only a bit of that. An H-number is a positive number which is one more than a multiple of four: 1, 5, 9, 13, 17,…
People are different. Some secretly read magazines full of interesting girls' pictures, others create an A-bomb in their cellar, others like using Windows, and some like difficult mathematical games. Latest marketing research shows, that this market…
题意:给一个数 可以写出多少种  连续素数的合 思路:直接线性筛 筛素数 暴力找就行   (素数到n/2就可以停下了,优化一个常数) 其中:线性筛的证明参考:https://blog.csdn.net/nk_test/article/details/46242401 https://blog.csdn.net/qq_40873884/article/details/79124552 https://blog.csdn.net/baoli1008/article/details/50788512…
 素数之和 题目大意:一些整数可以表示成一个连续素数之和,给定一个整数要你找出可以表示这一个整数的连续整数序列的个数 方法:打表,然后用游标卡尺法即可 #include <iostream> #include <functional> #include <algorithm> #define MAX_N 10010 using namespace std; static int primes_set[MAX_N], flag[MAX_N], p_sum; void in…
While skimming his phone directory in 1982, Albert Wilansky, a mathematician of Lehigh University,noticed that the telephone number of his brother-in-law H. Smith had the following peculiar property: The sum of the digits of that number was equal to…
类似素数筛... Semi-prime H-numbers Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 6873 Accepted: 2931 Description This problem is based on an exercise of David Hilbert, who pedagogically suggested that one study the theory of 4n+1 numbers. Her…
Semi-prime H-numbers Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7059   Accepted: 3030 Description This problem is based on an exercise of David Hilbert, who pedagogically suggested that one study the theory of 4n+1 numbers. Here, we…
Description The ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the four-digit room numbers on their offices.  — It is a matter of security to change such things every now…