竞赛
考级
对方正在输入...
#include<iostream> using namespace std; int main(){ int n; cin >> n; bool flag=1; for(int i=2;i<=n-1;i++ ){ if( n%i0 ){ flag = 0; break; } } if( n1 ) flag = 0; if( flag == 1 )cout<<"Yes"; else cout<<"No"; return 0; }
大神TT比QQ厉害爱编程
复仇者_必胜啊
#include<iostream> using namespace std; int main() { int n; cin >> n; }
666
#include <iostream> using namespace std; int main(){ int n,i; cin >> n; bool flag; if(n == 2){ flag = true; }else{ for(i = 2; i <= n - 1; i++){ if(n % i == 0){ flag = false; break; } } if(i == n){ flag = true; } } if(flag == true){ cout << "Yes"; }else{ cout << "No"; } return 0; }
🕈.👎.☝✌💧❄☜☼
#输入一个数 n=int(input()) #判断你是否为质数 for i in range (2,n): if n%i==0: print("No") break else: if n !=1: print("Yes") else: print("no")
138****3366
卢督庭
劳资上答案 睁大眼睛看好了
复制战神
151****9879
#include <iostream> #include <cmath> using namespace std; int main(){ int n; cin >> n; int a; if(n == 2){ cout << "Yes"; return 0; } if(n == 1){ cout << "No"; return 0; } if(n == 0){ cout << "No"; return 0; } for(int i = 2; i <= sqrt(n); i++){ if(n % i == 0){ a = 0; break; } else a = 1; } if(a) cout << "Yes"; else cout << "No"; return 0; }
落月wy
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; for(int i=2;i<n;i++){ if(n%i0){ cout << "No"; return 0; } } if(n1){ cout << "No"; return 0; } cout << "Yes"; return 0; }
谁看谁是**
只需要根骨头
189****8376
#include<iostream> using namespace std; int main() { int n; cin>>n; if(n1) { cout<<"No"; return 0; } for(int i=2;i*i<=n;i++) { if(n%i0) { cout<<"No"; return 0; } } cout<<"Yes"; return 0; }
张*程
#include <bits/stdc++.h> using namespace std; int main(){ int n,k=0; cin>>n; for(int i=1;i<=n;i++){ if(n%i0){ k++; } } if(k!=2){ cout<<"No"; }else if(k2){ cout<<"Yes"; }else if(n==1){ cout<<"No"; } }
精神小伙
共34条