delete pics to save space
This commit is contained in:
28
history_source/信息学奥赛一本通/1.6.1.8.cpp
Normal file
28
history_source/信息学奥赛一本通/1.6.1.8.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
/*
|
||||
x<EFBFBD><EFBFBD>,סy<D7A1><79>;
|
||||
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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user