14 lines
207 B
Go
14 lines
207 B
Go
|
package q05
|
||
|
|
||
|
func solveP2(nums []int) int {
|
||
|
var sum int
|
||
|
for _, v := range nums {
|
||
|
fuel := int(float64(v)/2.5 - 2)
|
||
|
for fuel > 0 {
|
||
|
sum += fuel
|
||
|
fuel = int(float64(fuel)/2.5 - 2)
|
||
|
}
|
||
|
}
|
||
|
return sum
|
||
|
}
|