Skip to content

Instantly share code, notes, and snippets.

@7yan00
Created January 3, 2015 12:37
Show Gist options
  • Save 7yan00/34413f605813be7e61d5 to your computer and use it in GitHub Desktop.
Save 7yan00/34413f605813be7e61d5 to your computer and use it in GitHub Desktop.
package main
import "fmt"
func main() {
var t, n, result int
fmt.Scan(&t, &n)
s := make([]int, n)
f := n - t + 1
for i := 0; i < n; i++ {
var a int
fmt.Scan(&a)
s[i] = a
}
for z := 0; z < f; z++ {
tmp := s[n]
for v := 1; v < t; v++ {
tmp += s[n+v]
if result < tmp {
tmp = result
}
fmt.Println(s)
fmt.Println(result)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment