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

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(){ int n; cin>>n; if(zs(n)==1){ cout<<"prime"; }else{ cout<<"not prime"; } }