← Home
For problem statement at 0-999/0-99/30-39/32/problemC.txt this is a correct solution, but verifier at 0-999/0-99/30-39/32/verifierC.go ends with All tests passed can you fix the verifier? package main

import (
	"bufio"
	"fmt"
	"os"
)

func countMax(L, s int64) int64 {
	if L%s == 0 {
		return L
	}
	q := L / s
	r := L % s
	return r * (q + 1)
}

func main() {
	in := bufio.NewReader(os.Stdin)
	var n, m, s int64
	if _, err := fmt.Fscan(in, &n, &m, &s); err != nil {
		return
	}
	cx := countMax(n, s)
	cy := countMax(m, s)
	ans := cx * cy
	out := bufio.NewWriter(os.Stdout)
	fmt.Fprintln(out, ans)
	out.Flush()
}