Created
September 14, 2019 08:28
-
-
Save surinoel/7abae1ac1c488fc4bc15d628f9950081 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cmath> | |
#include <iostream> | |
using namespace std; | |
double v[300000]; | |
int main(void) { | |
ios_base::sync_with_stdio(false); | |
cin.tie(nullptr); | |
int n; | |
cin >> n; | |
for (int i = 0; i < n; i++) { | |
cin >> v[i]; | |
} | |
double ans = v[n - 1]; | |
for (int i = n - 2; i >= 0; i--) { | |
ans = ceil(ans / v[i]) * v[i]; | |
} | |
cout << (long long)ans << '\n'; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment