🍣

2021/09/21に公開

# 前書き

AtCoder Beginners Selection は、AtCoder初心者向け問題集。
Goで競プロやる前に、一度解いてみる。

## PracticeA - Welcome to AtCoder

PracticeA - Welcome to AtCoder

``````package main

import (
"fmt"
)

func main() {
var a, b, c int
var s string

fmt.Scanf("%d", &a)
fmt.Scanf("%d", &b)
fmt.Scanf("%d", &c)
fmt.Scanf("%s", &s)

fmt.Printf("%d %s\n", a+b+c, s)
}

``````

## ABC086A-Product

ABC086A-Product

``````package main

import "fmt"

func main() {
var a, b int
fmt.Scanf("%d", &a)
fmt.Scanf("%d", &b)

if a*b%2 == 0 {
fmt.Println("Even")
} else {
fmt.Println("Odd")
}
}
``````

## ABC081A - Placing Marbles

ABC081A - Placing Marbles

``````package main

import (
"fmt"
"strings"
)

func main() {
var str string
count := 0
fmt.Scanf("%s", &str)

arr := strings.Split(str, "")

for i := 0; i < 3; i++ {
if arr[i] == "1" {
count++
}
}

fmt.Println(count)

}
``````

## ABC081B - Shift only

ABC081B - Shift

``````package main

import (
"fmt"
)

func main() {
resurt := 0
var le, tmp int

fmt.Scanf("%d", &le)

for i := 0; i < le; i++ {
fmt.Scanf("%d", &tmp)

cnt := 0
for tmp > 0 && tmp%2 == 0 {
tmp /= 2
cnt++
}

if i == 0 || cnt < resurt {
resurt = cnt
}

}

fmt.Println(resurt)

}
``````

## ABC087B - Coins

ABC087B - Coins

``````package main

import "fmt"

func main() {
var a, b, c, x int
cn := 0
fmt.Scanf("%d", &a)
fmt.Scanf("%d", &b)
fmt.Scanf("%d", &c)
fmt.Scanf("%d", &x)

for i := 0; i <= a; i++ {
for j := 0; j <= b; j++ {
for k := 0; k <= c; k++ {
sum := 500*i + 100*j + 50*k
if x == sum {
cn++
}

}
}
}

fmt.Println(cn)

}
``````

## ABC083B - Some Sums

ABC083B - Some Sums

``````package main

import "fmt"

func main() {
var n, a, b int
sum := 0

fmt.Scanf("%d", &n)
fmt.Scanf("%d", &a)
fmt.Scanf("%d", &b)

for i := 1; i <= n; i++ {
tmp := 0
for j := i; j > 0; j /= 10 {
tmp += j % 10
}
if tmp >= a && tmp <= b {
sum += i
}
}

fmt.Println(sum)

}

``````

## ABC085C - Otoshidama

ABC085C - Otoshidama
※随時更新

ABC049C - 白昼夢
※随時更新

## ABC086C - Traveling

ABC086C - Traveling
※随時更新