mirror of
https://git.wolves.top/wolves/leetcode.git
synced 2025-11-04 17:26:32 +08:00
init
This commit is contained in:
13
25/06/2929.go
Normal file
13
25/06/2929.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package main
|
||||
|
||||
func distributeCandies(n int, limit int) int64 {
|
||||
var res int64 = 0
|
||||
for i := 0; i <= min(n, limit); i++ {
|
||||
last := n - i
|
||||
if last > 2*limit {
|
||||
continue
|
||||
}
|
||||
res += int64(min(last, limit) - max(0, last-limit) + 1)
|
||||
}
|
||||
return res
|
||||
}
|
||||
Reference in New Issue
Block a user