3 条题解
-
112109俞天奇 LV 8 @ 2022-08-13 21:34:37
#include<bits/stdc++.h>
using namespace std;
int ss(int n)
{
for(int i=2;i<n;i++)
{
if(n%i == 0)
{
return -1;
}
}
return 1;
}
int main(){
int n;
cin>>n;
int s=ss(n);
if(s==1)
{
cout<<"Yes";
}
if(s==-1)
{
cout<<"No";
}
return 0;
} -
12021-12-17 19:36:11@
#include<stdio.h> #include<iostream> using namespace std; int main() { int a,b = 0; scanf("%d",&a); for (int i = 2;i<a;i++) { if (a%i==0) { b = 1; break; } else continue; } if (b == 0) printf ("Yes\n"); else if (b == 1) printf("No\n"); return 0; }
-
12021-11-18 19:40:31@
#include <iostream>
using namespace std;int main()
{
int n, i;
bool isPrime = true;
cin >> n;for(i = 2; i <= n / 2; ++i)
{
if(n % i == 0)
{
isPrime == false;
break;
}
}
if (isPrime)
cout << "Yes";
else
cout << "No";return 0;
}
- 1
信息
- ID
- 1632
- 难度
- 3
- 分类
- (无)
- 标签
- 递交数
- 108
- 已通过
- 56
- 通过率
- 52%
- 上传者