Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- int n, lvl = 0;
- long long int sum;
- cin >> n >> sum;
- if(n == 1)
- { int it = 1;
- while(sum > 0)
- {
- sum -= (it * it);
- it++;
- if(sum >= 0) lvl++;
- }
- }
- else
- {
- int it = 1;
- while(sum > 0)
- {
- sum -= (it * it);
- it += 2;
- if(sum >= 0) lvl++;
- }
- }
- cout << lvl << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement