Run ID Author Problem Lang Verdict Score Time Memory Code Length Submit Time
19907 桑迪 连续非素数的最长度 C++ Compile Error 0 0 MS 0 KB 316 2021-05-25 20:10:28

Tests(0/0):


#include<bits/stdc++.h> using namespace std; int n,maxp,nowp; bool prime(int a){ for(int i=2;i*i<=a;i++) if(a%i==0) return 0; return 1; } int main(){ cin>>n; for(int i=1;i<=n;i++){ if(prime(i)){ if(nowp>maxp) maxp=nowp; nowp=0; }else nowp++; } cout<<maxp; sleep(750); return 0; }


Judgement Protocol: