Skip to content

Instantly share code, notes, and snippets.

@surinoel
Created July 27, 2019 03:08
Show Gist options
  • Save surinoel/aeaad75a13df1fa8f1863b8feb84d005 to your computer and use it in GitHub Desktop.
Save surinoel/aeaad75a13df1fa8f1863b8feb84d005 to your computer and use it in GitHub Desktop.
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main(void) {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
vector<int> a(5);
for (int i = 0; i < 5; i++) {
cin >> a[i];
}
sort(a.begin(), a.end());
for (int i = a[2]; ; i++) {
int cnt = 0;
for (int k = 0; k < 5; k++) {
if (i%a[k] == 0) {
cnt += 1;
}
}
if (cnt >= 3) {
cout << i << '\n';
return 0;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment