Qiita Teams that are logged in
You are not logged in to any team

Community
Service
Qiita JobsQiita ZineQiita Blog
0
Help us understand the problem. What is going on with this article?
@nogawanogawa

# 前置き

Atcoderをやってみたので、自分用のメモです。
あとから加筆・修正する予定です。

# A

Q_A.go
``````package main

import (
"fmt"
)

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

fmt.Printf("%d\n", n-a+b)
}
``````

# B

Q_B.go
``````package main

import (
"fmt"
"math"
)

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

var t int
manhattan :=0
euqulid :=0
chebishev :=0

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

if t > 0 {
manhattan += t
}else{
manhattan -= t
}

euqulid += t*t

if t > 0 {
if t > chebishev{
chebishev = t
}
}else{
if -t > chebishev{
chebishev = -t
}
}
}

fmt.Printf("%d\n", manhattan)

fmt.Printf("%.10f\n", math.Sqrt(float64(euqulid)))

fmt.Printf("%d\n", chebishev)

}

``````

# C

Q_C.go
``````package main

import (
"fmt"
)

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

max := make([]int, 1)

for i:=1; i*i<n+1; i++{
if n % i == 0{
if n/i != i{
max = append(max, n/i)
}
fmt.Printf("%d\n", i)
}
}

for i:=len(max)-1; i>0; i--{
if max[i] != 0{
fmt.Printf("%d\n", max[i])
}
}
}
``````

# D

Q_D.go
``````package main

import (
"fmt"
)

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

var cnt uint64 = 0

for x < y/a & b/(a-1) {
cnt++
x *= a
}

cnt += (y-1-x)/b

fmt.Printf("%d\n", cnt)
}
``````

# F

0
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
1. We will deliver articles that match you
By following users and tags, you can catch up information on technical fields that you are interested in as a whole
2. you can read useful information later efficiently
By "stocking" the articles you like, you can search right away