For problem statement at 0-999/400-499/490-499/498/problemB.txt this is a correct solution, but verifier at 0-999/400-499/490-499/498/verifierB.go ends with All tests passed can you fix the verifier? package main
import (
"bufio"
"fmt"
"math"
"os"
)
func main() {
scanner := bufio.NewScanner(os.Stdin)
scanner.Split(bufio.ScanWords)
scanInt := func() int {
scanner.Scan()
res := 0
for _, b := range scanner.Bytes() {
res = res*10 + int(b-'0')
}
return res
}
scanner.Scan()
if len(scanner.Bytes()) == 0 {
return
}
n := 0
for _, b := range scanner.Bytes() {
n = n*10 + int(b-'0')
}
T := scanInt()
f := make([]float64, T+1)
f[0] = 1.0
ans := 0.0
for i := 0; i < n; i++ {
pi := scanInt()
ti := scanInt()
p := float64(pi) / 100.0
probTi := 1.0
if ti-1 > 0 {
probTi = math.Pow(1.0-p, float64(ti-1))
}
probTiP := probTi * p
fNew := make([]float64, T+1)
S := 0.0
for tPrime := 1; tPrime <= T; tPrime++ {
S = S * (1.0 - p)
S = S + f[tPrime-1]*p
if tPrime-ti >= 0 {
S = S - f[tPrime-ti]*probTiP
fNew[tPrime] = S + f[tPrime-ti]*probTi
} else {
fNew[tPrime] = S
}
ans += fNew[tPrime]
}
f = fNew
}
fmt.Printf("%.9f\n", ans)
}