#include <iostream>
#define MAXN 500005
using namespace std; //unsigned _m[MAXN];
bool mark[MAXN*]; int main()
{
//freopen("acm.acm","r",stdin);
// _m[0] = 0; int i;
int num; int p_1;
int p_2; while(cin>>num,num != -)
{
p_1 = p_2 = ;
memset(mark,,sizeof(mark));
for(i = ; i <= num; ++ i)
{ if(p_1 - i > && !mark[p_1 - i])
{
p_2 = p_1 - i;
mark[p_2] = true;
}
else
{
p_2 = p_1 + i;
mark[p_2] = true;
}
p_1 = p_2;
}
cout<<p_2<<endl;
}
}
关注我的公众号,当然,如果你对Java, Scala, Python等技术经验,以及编程日记,感兴趣的话。
技术网站地址: vmfor.com