提交时间:2021-05-16 16:49:07
运行 ID: 19534
#include<bits/stdc++.h> using namespace std; int Count,Sum,Answer; int Array[1000001]; int IsNotPrime(int x){ for(int i=2;i*i<=x;i++){ if(x%i==0) return 1; } return 0; } int main(){ cin>>Count; for(int i=1;i<=Count;i++){ if(IsNotPrime(i)) Sum++; else{ if(Sum>Answer) Answer=Sum; Sum=0; } } cout<<Answer; return 0; }