随笔分类 -  素数

摘要:problem已知正整数 n 是两个不同的质数的乘积试求出两者中较大的那个质数solution2个质数,所以没必要分解质因数。直接枚举,遇到小的一个因数,拿他除一下就是答案了。codes#includeusing namespace std;int main(){ ... 阅读全文
posted @ 2018-07-07 14:42 gwj1139177410 阅读(137) 评论(0) 推荐(0)
摘要:problem给定一个范围N回答M个某数字是否为质数的询问(Msolutioncodes#include#define maxn 10000010using namespace std;int pri[maxn];int main(){ int n, m; c... 阅读全文
posted @ 2018-06-08 21:55 gwj1139177410 阅读(91) 评论(0) 推荐(0)
摘要:problemsolutioncodes#include#include#includeusing namespace std;int a[30];int main(){ string str; cin>>str; for(int i = 0; i < ... 阅读全文
posted @ 2018-05-25 13:25 gwj1139177410 阅读(130) 评论(0) 推荐(0)
摘要:problemsolutioncodes#includeusing namespace std;int n, k, a[30], ans;int is_prime(int n){ if(n == 1 || n == 0)return 0; if(n == ... 阅读全文
posted @ 2018-05-24 13:27 gwj1139177410 阅读(127) 评论(0) 推荐(0)

选择