| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 19557 | 王循 | 连续非素数的最长度 | C++ | Wrong Answer | 0 | 2 MS | 1228 KB | 369 | 2021-05-16 18:03:59 |
#include <bits/stdc++.h> using namespace std; bool p[1000005]={1,1}; int n; void init() { for(int i=2;i*i<=1000000;i++) { if(!p[i]) { for(int j=i*i;j<=1000000;j+=i)p[j]=1; } } } int main() { cin>>n; init(); int maxn=0,s; for(int i=1;i<=n;i++) { if(p[i])s++; else maxn=max(maxn,s),s=0; } maxn=max(maxn,s); cout<<maxn<<endl; }