摘要:
题意:给定一个偶数n,求将其分解成两个素数的种数。思路:水水。。。题目链接:http://poj.org/problem?id=2909View Code 1 #include <cstdio> 2 #include <cmath> 3 #include <cstdlib> 4 #include <cstring> 5 #include <string> 6 #include <algorithm> 7 #include <iostream> 8 using namespace std; 9 const int 阅读全文
摘要:
题意:给定一个偶数n,将其分解成两个素数(有多组则输出差值最大的)。思路:水水.......题目链接:http://poj.org/problem?id=2262View Code 1 #include <cstdio> 2 #include <cmath> 3 #include <cstdlib> 4 #include <cstring> 5 #include <string> 6 #include <algorithm> 7 #include <iostream> 8 using namespace std 阅读全文
摘要:
题意:给定k,求所有满足小于2^k的所有梅森数(2^p(p为素数)-1被素因子分解的数)。思路:此题一看就想到打表、先暴力打表,然后直接写即可。题目链接:http://poj.org/problem?id=2191View Code 1 /**********************************暴力打表***************************** 2 #include <cstdio> 3 #include <cmath> 4 #include <cstdlib> 5 #include <cstring> 6 #incl 阅读全文
摘要:
题意:对于一个非素数p和任意一个数a,若a^p=a(mod p),则输出yes,否则输出no。思路:判断素数+二分幂。题目链接:http://poj.org/problem?id=3641View Code 1 #include <cstdio> 2 #include <cmath> 3 #include <cstdlib> 4 #include <cstring> 5 #include <string> 6 #include <algorithm> 7 #include <iostream> 8 using 阅读全文