Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
93461 张新福 素数判断 C++ Accepted 1 MS 264 KB 335 2024-10-16 15:57:02

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; } }