← Home
For problem statement at 0-999/500-599/500-509/509/problemE.txt this is a correct solution, but verifier at 0-999/500-599/500-509/509/verifierE.go ends with case 1 failed: expected 26.25357143 got 26.253571428571416
exit status 1 can you fix the verifier? package main

import (
	"fmt"
	"io"
	"os"
	"strings"
)

func isVowel(c byte) bool {
	switch c {
	case 'I', 'E', 'A', 'O', 'U', 'Y':
		return true
	default:
		return false
	}
}

func main() {
	data, _ := io.ReadAll(os.Stdin)
	s := strings.TrimSpace(string(data))
	n := len(s)

	h := make([]float64, n+1)
	p := make([]float64, n+1)
	for i := 1; i <= n; i++ {
		h[i] = h[i-1] + 1.0/float64(i)
		p[i] = p[i-1] + h[i]
	}

	var ans float64
	total := p[n]
	for i := 0; i < n; i++ {
		if isVowel(s[i]) {
			ans += total - p[n-i-1] - p[i]
		}
	}

	fmt.Printf("%.15f\n", ans)
}