Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
7766 | 赖梓乐 | 判断质数(使用while循环) | C++ | Accepted | 0 MS | 264 KB | 560 | 2025-05-17 19:55:33 |
#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ //,从2开始到根号n int n,i=2; bool f=true; cin>>n; while(i<=n/i){ if(n%i==0){ //cout<<"No"; f=false ; break; } i++; } if(f) cout<<"Yes"; else{ cout<<"No"; } return 0; }