Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
78587 杨宜炜 判断素数 C++ Accepted 0 MS 272 KB 338 2024-06-22 20:53:15

Tests(1/1):


Code:

#include<bits/stdc++.h> using namespace std; int zs(int n){ if(n<2){ return 0; } if(n==2){ return 1; } if(n%2==0){ return 0; } for(int i=3;i<n;i+=2){ if(n%i==0){ return 0; } } return 1; } int main(){ long long n; cin>>n; if(zs(n)==1){ cout<<"prime"; }else{ cout<<"not prime"; } }