Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "fmt"
- "time"
- )
- type ratio [2]int
- func add(x, y ratio) (answer ratio) {
- answer[0] = x[0] + y[0]
- answer[1] = x[1] + y[1]
- return
- }
- func solve(left, right ratio) (answer int) {
- next := add(left, right)
- if next[1] > 12000 {
- return 0
- }
- answer = 1 + solve(left, next) + solve(next, right)
- return
- }
- func problem73() int {
- return solve(ratio{1, 3}, ratio{1, 2})
- }
- func main() {
- start := time.Now()
- fmt.Println(problem73())
- end := time.Now()
- fmt.Println(end.Sub(start).Seconds())
- }
Add Comment
Please, Sign In to add comment