Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- #define ll long long
- #define mp make_pair
- #define pii pair<int, int>
- #define ft first
- #define sd second
- int32_t main() {
- cin.tie(NULL);
- cout.tie(NULL);
- ios_base::sync_with_stdio(false);
- int n, x;
- ll ans = 0;
- vector<vector<pii>> rectangles(3228 * 3228 / 4);
- cin >> n >> x;
- for (int a = 1; a <= n; a++)
- for (int b = 1; a + b - 1 <= n; b++)
- if (a >= b)
- rectangles[a * b].push_back(mp(a, b));
- for (int a = 1; a <= n; a++)
- if (a != x)
- for (int b = 1; a + b - 1 <= n; b++)
- if (a * b > n && b != x)
- for (auto p : rectangles[a * b - n]) {
- if (p.first < a && p.second < b)
- ans++;
- if (p.ft != p.sd && p.second < a && p.first < b)
- ans++;
- }
- cout << ans;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement