Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|---|
47436 | 石利伟 | 连续非素数的最长度 | C++ | Wrong Answer | 0 | 0 MS | 244 KB | 355 | 2022-07-14 20:22:24 |
#include<bits/stdc++.h> using namespace std; int n,ans=0,temp=0,i1=0; bool sushu(int num){ for(int i=2;i<=sqrt(num);i++){ if(num%i==0)return false; } return true; } int main(){ cin>>n; for(int i=1;i<=n;i++){ if(i1+1==i&&sushu(i)==true){ temp++; i1=i; ans=max(ans,temp); } else temp=0; } cout<<ans; return 0; }