LoginSignup
5
3

More than 5 years have passed since last update.

GoでAtcoder出てみるわ

Posted at

経緯

会社でGo使う事になったので、その勉強を兼ねてAtcoderの問題解きまくりてー
Atcoderでの問題を解く事で文法に慣れるが目標

GoをMacにinstall

brew を install
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

確認

$ brew update
Already up-to-date.

goをinstall

$ brew install go
==> Downloading https://homebrew.bintray.com/bottles/go-1.7.5.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring go-1.7.5.el_capitan.bottle.tar.gz
==> Caveats
As of go 1.2, a valid GOPATH is required to use the `go get` command:
  https://golang.org/doc/code.html#GOPATH

You may wish to add the GOROOT-based install location to your PATH:
  export PATH=$PATH:/usr/local/opt/go/libexec/bin
==> Summary
🍺  /usr/local/Cellar/go/1.7.5: 6,440 files, 250.8M

go path は未だ設定しない

練習問題を実施してみる

解く問題はこちら
http://abc053.contest.atcoder.jp/tasks/abc053_a

コードを書いて

a.go
package main

import (
    "fmt"
)

func main() {

    var x int
    ans := "ABC"

    fmt.Scan(&x)

    if x >= 1200 {
        ans = "ARC"
    }
    fmt.Println(ans)

}

実行

$ go run a.go
1222
ARC

提出して無事 Accept !
http://abc053.contest.atcoder.jp/submissions/1095734

5
3
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
3