Last active
November 20, 2016 07:22
-
-
Save whatalnk/0c6800b853e1ca504589f4d7d43bda94 to your computer and use it in GitHub Desktop.
AtCoder ABC #032 A. 高橋君と青木君の好きな数 [C++]
This file contains 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 <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