Advertisement
senb1

krsu 3386 (15 points)

Mar 1st, 2023
907
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. /*
  2. by: senb1
  3. */
  4.  
  5. #include <bits/stdc++.h>
  6.  
  7. #define ll long long
  8. #define all(x) x.begin(), x.end()
  9. #define fr first
  10. #define sc second
  11. #define mk make_pair
  12.  
  13. using namespace std;
  14.  
  15. const ll mod = 1e9 + 7;
  16. const ll maxn = 5e8;
  17. const ll inf = 1e9 + 6;
  18.  
  19. void solve() {
  20.     ll k, m;
  21.     cin >> k >> m;
  22.     ll w = k * m * m - 1, ans = 0;
  23.     for (ll x = 0; x <= maxn; x++) {
  24.         ll q = x * (x - m) * (x - 2 * m);
  25.         if (q >= -1 and q <= w)
  26.             ans++;
  27.     }
  28.     cout << ans << endl;
  29. }
  30. /*
  31.  
  32. */
  33.  
  34. int main() {
  35.     ios::sync_with_stdio(0);
  36.     cin.tie(0);
  37.  
  38.     int t = 1;
  39.     // cin >> t;
  40.     while (t--)
  41.         solve();
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement