Exemple #1
0
func NewSolver(lines []string) *Solver {
	l := base.GetInt(lines[0])
	a1 := base.GetIntList(lines[1])
	a2 := base.GetIntList(lines[2])
	return &Solver{
		l,
		a1,
		a2,
	}
}
Exemple #2
0
func NewSolver(n int, bs *bufio.Scanner) *Solver {
	flavors := base.GetInt(base.GetNextLine(n, bs))
	numcust := base.GetInt(base.GetNextLine(n, bs))
	cust := make([]*Customer, numcust, numcust)
	for i := 0; i < numcust; i++ {
		l := base.GetIntList(base.GetNextLine(n, bs))
		n := l[0]
		flav := make([]int, n, n)
		malt := make([]bool, n, n)
		for j := 1; j <= n; j++ {
			flav[j-1] = l[j*2-1]
			malt[j-1] = l[j*2] == 1
		}
		cust[i] = &Customer{flav, malt}
	}
	return &Solver{
		flavors,
		numcust,
		cust,
	}
}