Skip to content

Instantly share code, notes, and snippets.

@louy2
Last active March 9, 2016 07:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save louy2/378c696fea6a1b9eaf3e to your computer and use it in GitHub Desktop.
Save louy2/378c696fea6a1b9eaf3e to your computer and use it in GitHub Desktop.
「縞ニーソセット」ゲットチャレンジ!https://paiza.jp/poh/ando | 恋愛SLG: プログラミングで彼女をつくる|paizaオンラインハッカソン7
package main
import (
"fmt"
"os"
"log"
"strconv"
"bufio"
)
func parseStdin() (int, int) {
stdin := bufio.NewScanner(os.Stdin)
stdin.Scan()
unitLen, err := strconv.Atoi(stdin.Text())
if err != nil {
log.Fatal("fail to convert unitLen")
}
// fmt.Println(unitLen)
stdin.Scan()
totalLen, err := strconv.Atoi(stdin.Text())
if err != nil {
log.Fatal("fail to convert totalLen")
}
// fmt.Println(totalLen)
return unitLen, totalLen
}
func main(){
unitLen, totalLen := parseStdin()
colors := []string{"R", "W"}
for i := 0; i < totalLen; i++ {
fmt.Print(colors[i / unitLen % 2])
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment