首页
DreamJudge
院校信息
考研初试
考研复试
保研专区
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
彻底死去
2026年3月17日 19:33
素数判定 题解:
P1102
回复 0
|
赞 1
|
浏览 56
#include<iostream> #include<cstdio> #include<cmath> #include<algorithm> #include<string> #include<cstring> using namespace std; int main() { int a, b; while (cin >> a >> b) { if (a > b)swap(a, b); int cnt1,c...
太一
2026年3月17日 15:36
素数判定 题解:
P1102
回复 0
|
赞 2
|
浏览 44
#include<iostream> #include<cmath> #include<algorithm> #include<string> #include<map> using namespace std; int main() { int a, b; while (cin >> a >> b) { int sum = 0; ...
木晦
2026年3月16日 20:40
素数判定 题解:
P1102
回复 0
|
赞 2
|
浏览 49
#include <stdio.h> #include <stdbool.h> void sort(int *a,int *b){ if(*a > *b){ int temp=*a; *a=*b; *b=temp; } } bool Is...
ZeroQi_404
2026年3月15日 15:49
素数判定 题解:
P1102
回复 0
|
赞 2
|
浏览 73
#include <iostream> using namespace std; bool isPrime(int x){ if(x < 2) return false; for(int i = 2; i * i <= x; i++) if(x % i == 0) return false; return true; } int main(){ int a,b; while(cin >> a >> b){ int l = min...
Cat111
2026年3月11日 20:12
素数判定 题解:
P1102
回复 0
|
赞 2
|
浏览 101
#include <bits/stdc++.h> using namespace std; const int maxn=100000+5; int prime[maxn]; void getPrime(){ memset(prime,0,sizeof(prime)); for(int i=2;i<=maxn;i++){ if(!prime[i]) prime[++prime[0]]=i; for(int j=1;j<=prime[0]&&prime[j]*i<=maxn;j++){ prime[p...
Jinx_K
2026年3月10日 22:59
素数判定 题解:swap+issu
P1102
回复 0
|
赞 0
|
浏览 68
#include <bits/stdc++.h> using namespace std; int issu(int n) { int t = sqrt(n); int flag = 1;//judgement for (int i=2; i<=t; i++) if (n % i == 0) { flag = 0; break; } return flag; } int main() { int a,b; while (cin >> a>>b) { int c...
bro
2026年2月19日 14:09
素数判定 题解:c++ ,适合区间很大的时候
P1102
回复 0
|
赞 4
|
浏览 146
#include <bits/stdc++.h> using namespace std; bool isP(int n){ if(n == 2) return true; if(n == 1) return false; bool b = true; for(int i = 2; i <= sqrt(n) ; i++){ if(n % i == 0){ &...
bro
2026年2月19日 13:51
素数判定 题解:c++
P1102
回复 0
|
赞 5
|
浏览 76
#include <bits/stdc++.h> using namespace std; bool isP(int n){ if(n == 2) return true; if(n == 1) return false; bool b = true; for(int i = 2; i <= sqrt(n) ; i++){ if(n % i == 0){ &...
牧濑
2026年2月11日 23:01
素数判定 题解:暴力枚举
P1102
回复 0
|
赞 4
|
浏览 181
#include <iostream> #include <algorithm> using namespace std; bool isSS(int x){ if(x==1)return false;//情况1:1不是素数 else if(x==2)return true;//情况2:2是素数 else if(x%2==0){return false;}//情况3:大于2的偶数不是素数 //情况4:大于2的奇数进行判断 else{ for(int i=3;i*i<=x;i++){ if(x...
dddd225
2026年2月8日 16:11
素数判定 题解:
P1102
回复 0
|
赞 0
|
浏览 158
#include<bits/stdc++.h> using namespace std; const int N = 1010; int prime[N];//0表示是质数,1表示是合数 void getPrime(){ memset(prime,0,sizeof(prime)); for(int i = 2; i < N; i++){ if(!prime[i]) prime[++prime[0]]...
1
2
3
4
题目
素数判定
题解数量
37
发布题解
在线答疑
热门题解
1
素数判定 题解:素数定义+整体思路
2
素数判定 题解:c++
3
素数判定 题解:
4
素数判定 题解:暴力枚举
5
素数判定 题解:c++ ,适合区间很大的时候
6
素数判定 题解:为什么有错误啊佬们,dev c++能通过
7
素数判定 题解:简洁快速
8
素数判定 题解:
9
素数判定 题解:
10
素数判定 题解: