zoj 2723 Semi-Prime】的更多相关文章

两题水题: 1.如果一个数能被分解为两个素数的乘积,则称为Semi-Prime,给你一个数,让你判断是不是Semi-Prime数. 2.定义F(0) = 7, F(1) = 11, F(n) = F(n-1) + F(n-2) (n>=2) 让你判断第n项是否能被3整除. 1.ZOJ 2723 Semi-Prime http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1723 打表即可. #include<cstdio>…
题目链接: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2723 题目描述: Prime Number Definition An integer greater than one is called a prime number if its only positive divisors (factors) are one and itself. For instance, 2, 11, 67, 89 are pri…
思路:容易得到s[n]=s[n-1]+s[n-2],也就是fib数. 求第k小的fib质数的也就是第k个质数数-2,当k>2时. 在就是s[n]/x%m=s[n]%(x*m)/x. 代码如下: #include<cstdio> #include<algorithm> #include<cstring> #define ll long long #define M 1000005 using namespace std; ll k,x,m; int prime[M]…
Semi-Prime Time Limit: 2 Seconds      Memory Limit: 65536 KB Prime Number Definition An integer greater than one is called a prime number if its only positive divisors (factors) are one and itself. For instance, 2, 11, 67, 89 are prime numbers but 8,…
先上题目: Gaussian Prime Time Limit: 3 Seconds      Memory Limit: 65536 KB In number theory, a Gaussian integer is a complex number whose real and imaginary part are both integers. The Gaussian integers, with ordinary addition and multiplication of compl…
Prime Number Definition An integer greater than one is called a prime number if its only positive divisors (factors) are one and itself. For instance, 2, 11, 67, 89 are prime numbers but 8, 20, 27 are not. Semi-Prime Number Definition An integer grea…
// 题意都不好理解 我以为是求 一个数被分成2个素数和 然后是求分成2个素数积// 坑爹 忘记写 !=EOF 然后一直超时 然后换了几种 还是超时 一看别人代码 速度明显比我慢// 然后发现被自己坑了 #include <iostream> #include <math.h> #include <map> #include <stack> #include <queue> #include <vector> #include <…
 Prime Ring Problem Time Limit: 10 Seconds      Memory Limit: 32768 KB A ring is compose of n circles as shown in diagram. Put natural number 1, 2, ..., n into each circle separately, and the sum of numbers in two adjacent circles should be a prime…
ZOJ:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=312 POJ:http://poj.org/problem?id=1595 题目大意: 给你两个数n和c,如果1~n(包括1和n)之间的素数个数为偶数个,则输出中间c*2个素数否则输出中间c*2-1个素数. 思路: 呀呀呀,玩了一天了,A道水题洗洗睡吧. 直接筛选素数打表. 注意c比1~n的个数大的情况要把1~n中所以素数输出. OK,然后这题1也算素数.. #incl…
Prime Query Time Limit: 1 Second Memory Limit: 196608 KB You are given a simple task. Given a sequence A[i] with N numbers. You have to perform Q operations on the given sequence. Here are the operations: A v l, add the value v to element with index…