首页
DreamJudge
院校信息
考研初试
考研复试
保研专区
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
太一
2026年3月17日 16:09
素数判定 - 哈尔滨工业大学 题解:
P1355
回复 0
|
赞 3
|
浏览 93
#include<iostream> #include<cmath> #include<algorithm> #include<string> #include<map> using namespace std; int main() { int n; while (cin >> n) { if (n == 1) { ...
ZeroQi_404
2026年3月15日 00:02
素数判定 - 哈尔滨工业大学 题解:
P1355
回复 0
|
赞 0
|
浏览 172
#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 n; while(cin >> n){ if(isPrime(n)) cout << "yes" <<endl; ...
Jinx_K
2026年3月10日 22:36
素数判定 - 哈尔滨工业大学 题解:sqrt
P1355
回复 0
|
赞 0
|
浏览 193
#include <bits/stdc++.h> using namespace std; int issu(int n) { int t=sqrt(n); int flag=1;//judgement for(;t<n/2+1;t++) if(n%t==0) { flag=0; break; } return flag; } int main() { int n; while(cin>>n) { if(n<=1) cout<<"no"<&l...
uly
2026年3月5日 12:37
素数判定 - 哈尔滨工业大学 题解:
P1355
回复 0
|
赞 2
|
浏览 206
#include <bits/stdc++.h> using namespace std; bool is_su(int n) { if (n==1||n<=0) { return false; } for (int i=2; i<=sqrt(n); i++) { if (n%i == 0) { return false; } } return true; } int main() { int n; ...
SpontySoul
2026年2月20日 18:36
素数判定 - 哈尔滨工业大学 题解:
P1355
回复 0
|
赞 3
|
浏览 219
#include <bits/stdc++.h> using namespace std; int main() { int n; while(cin >> n){ bool flag = 1; if(n <= 0 || n == 1){ cout << "no" << endl; return 0; // 直接return } for(int i = 2; i <...
yauqq
2026年2月5日 17:09
素数判定 - 哈尔滨工业大学 题解:
P1355
回复 0
|
赞 0
|
浏览 226
#include<bits/stdc++.h> using namespace std; bool isPrime(int x) { if (x <= 1) return false; for (int i = 2; i * i <= x; ++i) if (x % i == 0) return false; return true; } int main(){ int n; while(cin >> n){ if(isPrime(n)) cout &l...
mlx
2026年2月3日 19:29
素数判定 - 哈尔滨工业大学 题解:
P1355
回复 0
|
赞 1
|
浏览 224
#include<iostream> using namespace std; int n; bool check(int n) { if(n<=1) return false; if(n==2) return true; for(int i=2;i*i<=n;i++) if(n%i==0) return false; return true; } int main() { while(cin>>n) { i...
曾不会
2026年1月25日 20:35
素数判定 - 哈尔滨工业大学 题解:
P1355
回复 0
|
赞 0
|
浏览 295
#include<stdio.h> #include<math.h> using namespace std; int fun(int x) { for(int i=2;i<=sqrt(x);i++) { if(x%i==0) {  ...
cczz
2025年8月9日 16:16
素数判定 - 哈尔滨工业大学 题解:
P1355
回复 0
|
赞 3
|
浏览 687
#include<bits/stdc++.h> using namespace std; bool isPrime(int a){ if(a <= 1) return false; for(int i = 2; i <= sqrt(a); i ++){ if(a % i == 0) return false; } return true; } int main(){ int t; while(cin >> t){ if(isPrime(t)) cout << "yes" <<...
西电机试专家
2025年2月12日 10:31
素数判定 - 哈尔滨工业大学 题解:素数定义+解题思路
P1355
回复 0
|
赞 17
|
浏览 1.5k
#include <bits/stdc++.h> using namespace std; //素数是指那些大于1,并且只能被1和它自己整除的数 //思路: 判断一个数是不是素数,即用它除以小于其根号的数[2-sqrt(i)],若能整除 则说明非素数 int main(){ int n; while(cin>>n) { int flag=0; &nb...
1
2
3
题目
素数判定 - 哈尔滨工业大学
题解数量
23
发布题解
在线答疑
热门题解
1
素数判定 - 哈尔滨工业大学 题解:素数定义+解题思路
2
素数判定 (试除法)- 哈尔滨工业大学 题解:
3
素数判定 - 哈尔滨工业大学 题解:
4
素数判定 - 哈尔滨工业大学 题解:
5
素数判定 - 哈尔滨工业大学 题解:
6
素数判定 - 哈尔滨工业大学 题解:,标记法,注意1不是素数
7
素数判定 - 哈尔滨工业大学 题解:
8
过
9
素数判定 - 哈尔滨工业大学 题解:
10
C++