add new solutions

This commit is contained in:
kanna5 2026-01-05 16:48:03 +09:00
parent ca24d0a56a
commit 0c73608ce5
Signed by: kkyy
GPG key ID: 06332F3965E9B0CF
36 changed files with 791 additions and 0 deletions

View file

@ -0,0 +1,21 @@
package q3516
func abs(n int) int {
if n < 0 {
return -n
}
return n
}
func findClosest(x int, y int, z int) int {
d1, d2 := abs(x-z), abs(y-z)
switch {
case d1 == d2:
return 0
case d1 < d2:
return 1
}
return 2
}
var _ = findClosest