这个题目本身基本上是对语言熟悉程度的考察,没有什么别的逻辑可言:
package main
import (
"fmt"
"strings"
)
func main() {
var a string
fmt.Scan(&a)
for len(a) > 0 {
if len(a) == 8 {
fmt.Printf("%s", a)
break
} else if len(a) < 8 {
tmp := strings.Repeat("0", 8-len(a))
a += tmp
fmt.Printf("%s", a)
break
} else {
fmt.Printf("%s\n", a[0:8])
a = a[8:]
}
}
}
标签:tmp,HJ4,fmt,len,牛客,Printf,main,刷题
From: https://www.cnblogs.com/wingsless/p/17115368.html