import java.util.Scanner; public class Main{     public static void main(String[] args){         Scanner scan = new Scanner(System.in);         while(scan.hasNext()){             int x = scan.nextInt();             int temp = x;             if(x<0){                   temp = -x;             }             if(temp==0){                   System.out.println(0);                   continue;             }             int cnt =0;             int sum = 0;             while(sum<temp){                   cnt++;                   sum = sum+cnt;                                }             while((sum-temp)%2!=0){                 cnt++;                 sum = sum+cnt;             }             System.out.println(cnt);                       }     } } 
点赞 2
牛客网
牛客企业服务