package main import ( ) /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * 计算两个数之和 * @param s string字符串 表示第一个整数 * @param t string字符串 表示第二个整数 * @return string字符串 */ func solve( s string , t string ) string { // write code here lens, lent := len(s), len(t) res := make([]byte, 0) add := 0 for lens > 0 || lent > 0 { a, b := 0, 0 if lens > 0 { a = int(s[lens-1]-'0') lens-- } if lent > 0 { b = int(t[lent-1]-'0') lent-- } a = a + b + add add = a /10 res = append(res, byte(a%10+'0')) } if add > 0 { res = append(res, byte(add+'0')) } for i,j := 0, len(res)-1; i < j; i, j= i+1, j-1 { res[i], res[j] = res[j], res[i] } return string(res) }