Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
6011 詹梓涵 判断质数(使用while循环) C++ Compile Error 0 MS 0 KB 603 2024-12-28 09:34:36

Tests(0/0):


Code:

#include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int n; cin>>n; int i=2; /* bool f=0; while(i*i,=n){//i<=sqrt(n) if(n%i==0) {f=1;break;} i++; } if(f==0){ cout<<"Yes"<<endl; } else{ cout<<"No"<<endl; } */ int cnt=2; i=2; do{ if(n%i==0) cnt++; i++; }while(i*i<=n); if(cnt>=3) cout<<"No"<<endl; else cout<<"Yes"<<endl; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:6:5: error: 'cin' was not declared in this scope
     cin>>n;
     ^
Main.cc:26:16: error: 'cout' was not declared in this scope
     if(cnt>=3) cout<"No"=3) cout<"No"<<endl;
                            ^
Main.cc:27:10: error: 'cout' was not declared in this scope
     else cout<<"Yes"<<endl;
          ^
Main.cc:27:23: error: 'endl' was not declared in this scope
     else cout<<"Yes"<<endl;
                       ^