Advertisement
Guest User

6

a guest
Jan 19th, 2020
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. using namespace std;
  5.  
  6. #define ll long long
  7. #define mp make_pair
  8. #define pii pair<int, int>
  9. #define ft first
  10. #define sd second
  11.  
  12. int32_t main() {
  13. cin.tie(NULL);
  14. cout.tie(NULL);
  15. ios_base::sync_with_stdio(false);
  16. int n, x;
  17. ll ans = 0;
  18. vector<vector<pii>> rectangles(3228 * 3228 / 4);
  19. cin >> n >> x;
  20. for (int a = 1; a <= n; a++)
  21. for (int b = 1; a + b - 1 <= n; b++)
  22. if (a >= b)
  23. rectangles[a * b].push_back(mp(a, b));
  24. for (int a = 1; a <= n; a++)
  25. if (a != x)
  26. for (int b = 1; a + b - 1 <= n; b++)
  27. if (a * b > n && b != x)
  28. for (auto p : rectangles[a * b - n]) {
  29. if (p.first < a && p.second < b)
  30. ans++;
  31. if (p.ft != p.sd && p.second < a && p.first < b)
  32. ans++;
  33. }
  34. cout << ans;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement