[POJ 1365] Prime Land】的更多相关文章

题目链接: 传送门 Prime Land Time Limit: 1000MS     Memory Limit: 10000K Description Everybody in the Prime Land is using a prime base number system. In this system, each positive integer x is represented as follows: Let {pi}i=0,1,2,... denote the increasing…
Prime Land Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 3211   Accepted: 1473 Description Everybody in the Prime Land is using a prime base number system. In this system, each positive integer x is represented as follows: Let {pi}i=0,…
题意:感觉题意不太好懂,题目并不难,就是给一些p和e,p是素数,e是指数,然后把这个数求出来,设为x,然后让我们逆过程输出x-1的素数拆分形式,形式与输入保持一致. 思路:素数打表以后正常拆分即可. 注意:输入过程需要优化,我以前经常使用字符串模拟的方式,后来发现那种方法比较笨,还是下面的方法简洁:代码如下: #include<iostream> #include<cstdio> #include<cmath> #include<cstring> using…
英文题读不懂题==质数幂的形式给你一个数 把它减一再用质数幂的形式表示出来 *解法:质数从小到大模拟除一遍,输入有点别扭 #include <iostream> #include <cstdio> #include <cstring> using namespace std; #define SZ 33005 char a[100]; bool isprime[SZ]; int primes[SZ], num[SZ]; int cnt; void prime(int n…
Everybody in the Prime Land is using a prime base number system. In this system, each positive integer x is represented as follows: Let {pi}i=0,1,2,... denote the increasing sequence of all prime numbers. We know that x > 1 can be represented in only…
  POJ 3126  Prime Path Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 16204   Accepted: 9153 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…
题目链接:poj 2689 Prime Distance 题意: 给你一个很大的区间(区间差不超过100w),让你找出这个区间的相邻最大和最小的两对素数 题解: 正向去找这个区间的素数会超时,我们考虑逆向思维: 我们先用线性筛 筛出前50000的素数,在int范围内的区间的合数的因子都在我们之前筛出来了, 然后我们就把这个区间的合数标记出来,剩下的就是素数了. 标记合数也是用全部的素数去筛一下,这样就能快速的标记这个区间的合数,然后在暴力枚举一下这个区间,更新一下答案. #include<cst…
POJ 3126 Prime Path(素数路径) Time Limit: 1000MS    Memory Limit: 65536K 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…
POJ 1811 Prime Test Time Limit: 6000MS   Memory Limit: 65536K Total Submissions: 32534   Accepted: 8557 Case Time Limit: 4000MS Description Given a big integer number, you are required to find out whether it's a prime number. Input The first line con…
POJ 3518 Prime Gap(素数) id=3518">http://poj.org/problem? id=3518 题意: 给你一个数.假设该数是素数就输出0. 否则输出比这个数大的素数与比这个数小的素数的差值. 分析: 明显本题先要用筛选法求出130W(个素数)以内的全部素数. 然后推断给的数是否是素数就可以. 假设不是素数.那么就找出它在素数素组内的上界和下界,输出两个素数的差值就可以. 筛选法求素数可见: http://blog.csdn.net/u013480600/a…