Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- long long a, b;
- cin >> a >> b;
- long long s = a + 2 * b;
- if (s < 4){
- if (s == 1) cout << 4;
- else if (s == 2) cout << 6;
- else if (s == 3) cout << 8;
- return 0;
- }
- long long tmp = int(sqrt(s));
- s -= tmp * tmp;
- if (s != 0) cout << 2 * (tmp + tmp + (s / tmp) + 1);
- else cout << 4 * tmp;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement