待更新…
1. 牛客
package main
import "fmt"
func main() {
a := 0
b := 0
for {
n, _ := fmt.Scan(&a, &b)
if n == 0 {
fmt.Println(n)
break
} else {
fmt.Printf("%d\n", a+b)
}
}
}
2. 小米 OJ
package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
)
func solution(line string) string {
lineArr := strings.Split(line, " ")
l, _ := strconv.Atoi(lineArr[0])
r, _ := strconv.Atoi(lineArr[1])
tmp1 := l + r
tmp2 := r - l + 1
if (tmp1 % 2) == 0 {
tmp1 /= 2
} else {
tmp2 /= 2
}
ans := ((tmp1 % 15) * (tmp2 % 15)) % 15
return strconv.Itoa(ans)
}
func main() {
r := bufio.NewReaderSize(os.Stdin, 20480)
for line, _, err := r.ReadLine(); err == nil; line, _, err = r.ReadLine() {
fmt.Println(solution(string(line)))
}
}