|
@@ -7,7 +7,7 @@ import (
|
|
|
"strings"
|
|
"strings"
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
-func is_valid(id int) bool {
|
|
|
|
|
|
|
+func is_invalid(id int) bool {
|
|
|
idstr := strconv.Itoa(id)
|
|
idstr := strconv.Itoa(id)
|
|
|
size_idstr := len(idstr)
|
|
size_idstr := len(idstr)
|
|
|
if (size_idstr % 2) != 0 {
|
|
if (size_idstr % 2) != 0 {
|
|
@@ -16,10 +16,10 @@ func is_valid(id int) bool {
|
|
|
return idstr[:size_idstr/2] == idstr[size_idstr/2:]
|
|
return idstr[:size_idstr/2] == idstr[size_idstr/2:]
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func count_valids(lb, ub int) int{
|
|
|
|
|
|
|
+func count_invalids(lb, ub int) int{
|
|
|
res := 0
|
|
res := 0
|
|
|
for i:=lb; i <= ub; i++ {
|
|
for i:=lb; i <= ub; i++ {
|
|
|
- if is_valid(i) {
|
|
|
|
|
|
|
+ if is_invalid(i) {
|
|
|
res += i
|
|
res += i
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -38,7 +38,7 @@ func main() {
|
|
|
ranges = strings.Split(value,"-")
|
|
ranges = strings.Split(value,"-")
|
|
|
lower_bound, _ = strconv.Atoi(ranges[0])
|
|
lower_bound, _ = strconv.Atoi(ranges[0])
|
|
|
upper_bound, _ = strconv.Atoi(ranges[1])
|
|
upper_bound, _ = strconv.Atoi(ranges[1])
|
|
|
- res += count_valids(lower_bound, upper_bound)
|
|
|
|
|
|
|
+ res += count_invalids(lower_bound, upper_bound)
|
|
|
}
|
|
}
|
|
|
fmt.Println(res)
|
|
fmt.Println(res)
|
|
|
}
|
|
}
|