ENG  RUS Timus Online Judge
Online Judge
Problems
Authors
Online contests
Site news
Webboard
Problem set
Submit solution
Judge status
Guide
Register
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

## How to write Go solutions

Go programs are compiled on the server by the Go 1.14.6 x64. The compiler is invoked with the following parameters:

``````go build %1
``````

You can find the compiler here.

### An example of solving a problem

A sample solution for the 1000. A + B problem in Go:

``````package main
import "fmt"

func main() {
var a, b int
fmt.Scan(&a)
fmt.Scan(&b)
fmt.Println(a + b)
}
``````

A sample solution for the 1001. Reverse Root in Go:

``````package main
import "fmt"
import "math"

var a [262144]int64

func main() {
n := 0
for {
var x int64
k, _ := fmt.Scan(&x)
if k != 1 {
break
}
a[n] = x
n++
}
for n > 0 {
n--
fmt.Printf("%.4f\n", math.Sqrt(float64(a[n])))
}
}
``````

More effective solution of the same problem:

``````package main
import "os"
import "fmt"
import "math"
import "bufio"
import "strings"
import "strconv"

func main() {
out := bufio.NewWriter(os.Stdout)