Skip to content

Instantly share code, notes, and snippets.

@DVegasa
Last active September 4, 2018 09:48
Show Gist options
  • Save DVegasa/19bf96b463c48643ade4657721ef3d8a to your computer and use it in GitHub Desktop.
Save DVegasa/19bf96b463c48643ade4657721ef3d8a to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
bool DEBUG = false;
int main() {
int n;
cin >> n;
int nums[n];
for (int i = 0; i < n; i++) {
cin >> nums[i];
}
int cur = 1;
int max = 1;
for (int i = 1; i < n; i++) {
if (nums[i] <= nums[i-1] * 2) {
cur++;
if (cur > max) max = cur;
} else {
cur = 1;
}
}
cout << max << endl;
return 0;
}
// Compiler: v.5.1.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment