Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- typedef long long ll;
- typedef long double ld;
- const ll A = 911382323;
- const ll B = 972663749;
- const ll mod = 1e9 + 7;
- const int N = 1e5 + 500;
- const int M = 5e5 + 500;
- #define F first
- #define S second
- #define PB push_back
- #define all(v) (v).begin(), (v).end()
- #define sz(x) (int)x.size()
- //#define endl '\n'
- int dd[4][2]={{-1,0},{1,0},{0,1},{0,-1}};
- int main()
- {
- ios_base::sync_with_stdio(0); cin.tie(0);
- cout<<fixed<<setprecision(20);
- //freopen("input.txt", "r", stdin);
- //freopen("output.txt", "w", stdout);
- ll n; cin>>n;
- ll x = sqrt(n);
- if(x & 1){
- ll i = x,j = x;
- ll k = n - x * x;
- if(k >= 3){
- i++; k -= 3;
- i -= ((k/2) & 1?1:0);
- j -= (k+1) / 2;
- }else if(k == 1){
- j++;
- }else if(k == 2){
- i++, j++;
- }
- if(!((x/2) & 1)) swap(i,j);
- cout<<i<<' '<<j<<endl;
- }else{
- ll i = 1,j = x;
- ll k = n - x * x;
- i += (k-1) / 2;
- j += (k?((k/2) & 1?2:1):0);
- if(!((x/2) & 1)) swap(i,j);
- cout<<i<<' '<<j<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement