Topcoder SRM 477 "VacationTime"

問題:http://www.topcoder.com/stat?c=problem_statement&pm=10884 (要ログイン)

Go言語で書く練習.

import "math"

func bestSchedule(N int, K int, workingDays []int) (min int) {
	min = math.MaxInt32
	for i := 0; i <= N-K; i++ {
		c := 0
		for _, wd := range workingDays {
			if i < wd && wd <= i+K {
				c++
			}
		}
		if min > c {
			min = c
		}
	}
	return
}