Files
OI-source/history_source/信息学奥赛一本通/1.6.1.8.cpp
2023-08-03 09:22:52 +08:00

29 lines
331 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include<cstdio>
using namespace std;
/*
x¼Ò,סyºÅ;
x*(x+1)/2-2*y=n;
2*y+n=x*(x+1)/2;
2*y=x*(x+1)/2-n;
y=(x*(x+1)/2-n)/2;
*/
int main()
{
int n;
scanf("%d",&n);
for(int i=2;;i++)
{
if((i*(i+1)/2-n)%2==0)
{
int y=(i*(i+1)/2-n)/2;
if(y>0&&y<=i)
{
printf("%d %d\n",y,i);
return 0;
}
}
}
return 0;
}