两题水题: 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=2060 题目描述: There are another kind of Fibonacci numbers: F(0) = 7, F(1) = 11, F(n) = F(n-1) + F(n-2) (n>=2) Input Input consists of a sequence of lines, each containing an integer n. (…
题目链接: 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 <…
2679:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1679 2952:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1951 ZOJ:2679先来~ 水题大意:(题目大意:我什么时候改名了哇T T) 给你一个5位数的中间三个字母,还有一个数N让你求能被N整除的最大的五位数. 思路: 直接暴力枚举.... #include<cstdio> int…
Number Game Time Limit: 2 Seconds      Memory Limit: 65536 KB The bored Bob is playing a number game. In the beginning, there are n numbers. For each turn, Bob will take out two numbers from the remaining numbers, and get the product of them. There i…