题解
2023-07-10 17:41:14
发布于:上海
14阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
int main() {
int T;
int anser = 0 ;
cin >> T;
if(T<0)T=-T;
int i = 1 ;
int te = 1;
while(T!=0 && !anser){
if(te == T || (te > T && !((te - T)%2))) anser = i ;
i++;
te += i ;
}
cout << anser << endl;
return 0;
}
这里空空如也
有帮助,赞一个