直接水过
#include<iostream> #include<algorithm> using namespace std; const int maxn=2e5+10; int a[maxn]; int n, u,maxx; int main(){ cin>>n; u=1; for(int i=0;i<n;++i)cin>>a[i]; for(int i=0;i<n-1;++i){ if(a[i]*2>=a[i+1]){ ++u; } else{ maxx=max(maxx, u); u=1; } } maxx=max(maxx, u); cout<<maxx<<endl; }
原文地址:https://www.cnblogs.com/ALINGMAOMAO/p/10697862.html
时间: 2024-11-09 16:20:22