Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
93620 张新福 判断素数 C++ Accepted 1 MS 272 KB 337 2024-10-18 18:13:15

Tests(1/1):


Code:

#include <bits/stdc++.h> using namespace std; bool sushu(int n){ bool r=true; int i; for(i=2;i<=sqrt(n);i++){ if(n%i==0){ r=false; break; } } if(n<=1){ r=false; } return r; } int main(){ int a; cin>>a; if(sushu(a)==true){ cout<<"prime"<<endl; }else{ cout<<"not prime"<<endl; } }