← Home
For problem statement at 0-999/0-99/10-19/11/problemB.txt this is a correct solution, but verifier at 0-999/0-99/10-19/11/verifierB.go ends with All tests passed can you fix the verifier? package main

import "fmt"

func main() {
	var x int
	fmt.Scan(&x)
	if x < 0 {
		x = -x
	}
	sum := 0
	for n := 0; ; n++ {
		sum += n
		if sum >= x && (sum-x)%2 == 0 {
			fmt.Println(n)
			break
		}
	}
}