| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 74565 | 陈路垚 | 连续非素数的最长度 | C++ | Accepted | 100 | 340 MS | 256 KB | 468 | 2023-05-27 16:31:00 |
#include<bits/stdc++.h> using namespace std; long long c[1000001]; bool pri(long long n) { if(n<2) return false; for(long long i=2; i*i<=n; i++) { if(n%i==0) return false; } return true; } long long old=2,maxn=0,n; int main() { cin>>n; if(n<3) { cout<<1; return 0; } for(long long i=3; i<=n; i++) { if(pri(i)) { maxn=max(maxn,i-old-1); old=i; } } if(old!=n) { maxn=max(maxn,n-old); } cout<<maxn; return 0; }