Skip to content

Instantly share code, notes, and snippets.

@whatalnk
Last active November 20, 2016 07:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whatalnk/0c6800b853e1ca504589f4d7d43bda94 to your computer and use it in GitHub Desktop.
Save whatalnk/0c6800b853e1ca504589f4d7d43bda94 to your computer and use it in GitHub Desktop.
AtCoder ABC #032 A. 高橋君と青木君の好きな数 [C++]
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int main() {
int a, b, n;
cin >> a >> b >> n;
int x = min({a, b});
int y = max({a, b});
int z = n / y;
while (1) {
if (y * z >= n && y * z % x == 0){
cout << y * z << endl;
return 0;
}
z++;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment