#include <cstdio>
#include <iostream>
#include <cmath>
using namespace std;
typedef long long ll;
ll sum(ll n)
{
return n*n;
}
int main()
{
ll i, lev, lim, mid;
while (cin >> i && i)
{
lev = (ll)ceil(sqrt(i));
if (lev&1)
{
lim = lev*lev;
mid = lim - (lev-1);
if (i<mid)
{
cout << lev << " " << i-(lev-1)*(lev-1) << endl;
} else
{
cout << lim-(i)+1 << " " << lev << endl;
}
} else
{
lim = lev*lev;
mid = lim - (lev-1);
if (i>=mid)
{
cout << lev << " " << lim-i+1 << endl;
} else
{
cout << i-(lev-1)*(lev-1) << " " << lev << endl;
}
}
}
return 0;
}
Thursday, November 10, 2011
[UVa] 10161 - Ant on a Chess Board
Subscribe to:
Post Comments (Atom)
Connect Rapoo MT750S with Linux (Tested on Manjaro)
I bought this obvious copy of MX Master 2S in hopes of having the device switching functionality along with a lightweight body because I ha...
-
I like coding a lot, keeps me glued to the PC for hours. For that reason it's a need to edit the Syntax Highlighter to suit my eyes for...
-
I bought this obvious copy of MX Master 2S in hopes of having the device switching functionality along with a lightweight body because I ha...
-
Method: The problem at first glance seems too straightforward but it's not that much. Think a bit about the lines "Erin can add ...
No comments:
Post a Comment
Post your comment here. If you want to say something about programming problems, scripts, software etc, please try to be as descriptive as possible.