题解 | 进制A+B
进制A+B
https://www.nowcoder.com/practice/6187581174ac48278ca3bccf8d534897
package main import ( "fmt" "strconv" ) func main() { var a, b string fmt.Scanf("%s %s", &a, &b) aDecimal, err := strconv.ParseInt(a, 0, 64) if err != nil { fmt.Println("Error parsing hexadecimal:", err) return } bDecimal, err := strconv.ParseInt(b, 0, 64) if err != nil { fmt.Println("Error parsing octal:", err) return } result := aDecimal + bDecimal fmt.Println(result) }