Run ID Author Problem Lang Verdict Score Time Memory Code Length Submit Time
47440 石利伟 连续非素数的最长度 C++ Accepted 100 122 MS 248 KB 320 2022-07-14 20:25:14

Tests(10/10):


#include<bits/stdc++.h> using namespace std; int n,ans=0,temp=0; int sushu(int num){ for(int i=2;i<=sqrt(num);i++){ if(num%i==0)return 0; } return 1; } int main(){ cin>>n; for(int i=1;i<=n;i++){ if(sushu(i)==0){ temp++; ans=max(ans,temp); } else temp=0; } cout<<ans; return 0; }


Judgement Protocol: