Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- using namespace std;
- int main(void) {
- int l;
- int w;
- int a;
- bool works = false;
- cin >> l >> w >> a;
- int b = l * w - a;
- if (w > l) {
- swap(w, l);
- }
- if (b > a) {
- swap(a, b);
- }
- /* for langsomt :(
- for (int i = 1; i <= w; i++) {
- int tmp = i * l;
- if (i * l == b) {
- works = true;
- break;
- }
- while (tmp >= b) {
- if (tmp % b == 0) {
- works = true;
- break;
- }
- tmp -= i;
- }
- }*/
- /* Doesn't work :((
- if (max(b, l) % min(b, l) == 0) {
- works = true;
- }*/
- if ((((l * w) % a) % w) == 0 || (((l * w) % a) % l) == 0) {
- cout << 1;
- }
- else if (works) {
- cout << 2;
- }
- else {
- cout << 3;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement