10161
一道小水题,推一下规律即可
//============================================================================
// Name : 10161.cpp
// Author :
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int t, t1;
double n;
int main() {
//freopen("a.txt", "r", stdin);
while(scanf("%lf", &n)&&(fabs(n) > 1e-10))
{
t = (int)sqrt(n);
if((int)(n) == t*t)
{
if(t%2)
{
printf("1 %d\n", t);
continue;
}
else
{
printf("%d 1\n", t);
continue;
}
}
else
{
t1 = (int)(n) - t*t;
if(t%2)
{
if(t1 >=1&&t1 <= t+1)
{
printf("%d %d\n", t1, t+1);
}
else
{
printf("%d %d\n", t+1, (t+1)*(t+1)+1-(int)(n));
}
}
else
{
if(t1 >=1&&t1 <= t+1)
{
printf("%d %d\n", t+1, t1);
}
else
{
printf("%d %d\n", (t+1)*(t+1)+1-(int)(n), t+1);
}
}
}
}
return 0;
}

浙公网安备 33010602011771号