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