Please subscribe to the official Codeforces channel in Telegram via the link: https://t.me/codeforces_official. ×

### Logout's blog

By Logout, history, 3 years ago, ,

To get better at Golang, I decided to try solving Codeforces (CF) problems in Go. I was a bit surprised that the current Go version on CF is (out-of-dated) 1.2, while the current stable Go version is 1.5.
Having said that, my solution for this C div 2 produced correct answers for the given two sample testcases on my computer (with Go 1.5), but gave wrong answers on CF. I've looked at the issue for a while, but could not understand the cause. Could anyone give me some hint?

By the way, is there any plan to update the Go version on Codeforces? I'm not sure who (Mike Mirzayanov?) I should ask for this, though.

 » 3 years ago, # | ← Rev. 3 →   +5 add "\n" to Scanf fmt.Scanf("%d\n", &n) .... fmt.Scanf("%d %d %d\n", &vi, &di, &pi), Accepted: 13594647
•  » » 3 years ago, # ^ |   0 Thanks, that solved my problem. A lesson learned when using Scanf, but I still does not thoroughly understand how the same code could produce different results on my computer vs CF, though.
•  » » » 3 years ago, # ^ |   0 I suppose, the behaviour of Scanf changed in new versions.
 » 3 years ago, # | ← Rev. 2 →   +8 I would be also glad to see the update to the Go compiler.I think it would be a positive change for the CodeForces project as a whole to update all the compilers (if there're new versions of course) at least once a year.PS: I understand that I can't ask or demand anything, when CodeForces is already awesome :)
 » 13 months ago, # |   0 Why are Golang's Scanf very slow. I usually get TLE.
•  » » 12 months ago, # ^ |   +1 Hi! If you want to read n lines with 3 numbers in line and manipulate with n1, n2, n3 inside for block use this code: n := 2 n1, n2, n3 := 0, 0, 0 for i:=0; i
•  » » » 12 months ago, # ^ |   0 Thank for your help.
 » 13 months ago, # |   0 I am using Go 1.9.2 (Mac OS) and doing some testing on local, it always run good. But when submit to Codeforces it always fail.I try to debug myself, and find that the reason is because it can not read data.For example, I want to read these two lines: 1 2 3 3 4 5 I use fmt.Scanf and it not work var a, b string fmt.Scanf("%s", &a) fmt.Scanf("%s", &b) So, I decide to write the Readline function using bufio: func ReadLine() (string, error) { line, err := bufio.NewReader(os.Stdin).ReadString('\n') if err != nil { return "", err } return strings.TrimSpace(string(line)), nil } var a, b a, _ = Readline() b, _ = Readline() And now, the problem is I got "EOF" error when reading the second line.So what is the best way to read line in these kind of test?
•  » » 4 months ago, # ^ |   0 I have met the similar problem. So do you have found the solution?