← 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 (
	"bufio"
	"fmt"
	"os"
)

func main() {
	in := bufio.NewReader(os.Stdin)
	var x int64
	fmt.Fscan(in, &x)

	if x < 0 {
		x = -x
	}

	var k, sum int64
	for {
		k++
		sum += k
		if sum >= x && (sum-x)%2 == 0 {
			break
		}
	}

	fmt.Println(k)
}