Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- using ll = long long;
- int main() {
- ll n;
- cin>>n;
- ll rnd = 0;
- while(rnd * (4 * rnd + 3) <= n) rnd++;
- rnd--;
- int x = 0;
- int y = rnd;
- n -= rnd * (4 * rnd + 3);
- while(n && x >-rnd-1) x--, n--;
- while(n && y >-rnd-1) y--, n--;
- while(n && x < rnd+1) x++, n--;
- while(n && y < rnd+1) y++, n--;
- while(n ) x--, n--;
- cout<<x<<" "<<y<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement