ZOJ - 3483 - Gaussian Prime】的更多相关文章

先上题目: 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…
提醒:答案要约分,不然会错! #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<stdio.h> #include<string.h> #include<math.h> using namespace std; ; int prime[MAXSIZE]; void init_prim(){ ;i<MAX…
思路:容易得到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]…
1001 Gaussian Prime http://www.tzcoder.cn/acmhome/problemdetail.do?&method=showdetail&id=3798 .......................................我是真的一言难尽 1002 Sum of Factorials http://www.tzcoder.cn/acmhome/problemdetail.do?&method=showdetail&id=2696…
 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…
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 i…
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 i…
这道题我改啊,改啊,交啊,就对了. #include <stdio.h> #include <stdlib.h> #include <math.h> #include<cstring> #include<algorithm> using namespace std; ; ; int a[N]; int p[M]; ],cover[M*]; void Prime() { a[] = ; ; i<sqrt(N); i++) { if(a[i])…