mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-04 16:12:47 +08:00
14 lines
206 B
Go
14 lines
206 B
Go
package leetcode
|
|
|
|
func totalMoney(n int) int {
|
|
res := 0
|
|
for tmp, count := 1, 7; n > 0; tmp, count = tmp+1, 7 {
|
|
for m := tmp; n > 0 && count > 0; m++ {
|
|
res += m
|
|
n--
|
|
count--
|
|
}
|
|
}
|
|
return res
|
|
}
|