← Home
For problem statement at 0-999/200-299/200-209/203/problemA.txt this is a correct solution, but verifier at 0-999/200-299/200-209/203/verifierA.go ends with All 100 tests passed can you fix the verifier? package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	var x, t, a, b, da, db int
	fmt.Fscan(in, &x, &t, &a, &b, &da, &db)

	ok := x == 0

	for i := 0; i < t; i++ {
		s1 := a - i*da
		if s1 == x {
			ok = true
		}
	}

	for j := 0; j < t; j++ {
		s2 := b - j*db
		if s2 == x {
			ok = true
		}
	}

	for i := 0; i < t; i++ {
		s1 := a - i*da
		for j := 0; j < t; j++ {
			s2 := b - j*db
			if s1+s2 == x {
				ok = true
			}
		}
	}

	if ok {
		fmt.Fprintln(out, "YES")
	} else {
		fmt.Fprintln(out, "NO")
	}
}