← Home
For problem statement at 0-999/600-699/660-669/661/problemA.txt this is a correct solution, but verifier at 0-999/600-699/660-669/661/verifierA.go ends with All tests passed can you fix the verifier? package main

import (
	"bufio"
	"fmt"
	"math/big"
	"os"
	"strings"
)

func main() {
	in := bufio.NewReaderSize(os.Stdin, 1<<20)
	out := bufio.NewWriterSize(os.Stdout, 1<<20)
	defer out.Flush()

	var t int
	if _, err := fmt.Fscan(in, &t); err != nil {
		return
	}

	one := big.NewInt(1)
	two := big.NewInt(2)
	var sb strings.Builder

	for i := 0; i < t; i++ {
		var s string
		fmt.Fscan(in, &s)

		n := new(big.Int)
		n.SetString(s, 10)

		res := new(big.Int).Mul(n, new(big.Int).Add(n, one))
		res.Div(res, two)
		res.Add(res, one)

		sb.WriteString(res.String())
		if i+1 < t {
			sb.WriteByte('\n')
		}
	}

	out.WriteString(sb.String())
}