Notes for HHKB Programming Contest 2020

Preface

I tried Atcoder, so it's a memo for myself. I plan to add and correct it later.

problem

https://atcoder.jp/contests/hhkb2020

A

Q_A.go


package main

import (
    "fmt"
)

func main() {
    var s string
    fmt.Scan(&s)

    var t string
    fmt.Scan(&t)
    
	if s == "Y"{
        if t == "a"{
            t = "A"
        } else if t == "b"{
            t = "B"
        } else if t == "c"{
            t = "C"
        }
    }

    fmt.Printf("%s\n", t)
}

B

Q_B.go


package main

import (
	"fmt"
	"strings"
)

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

	S := make([][]string, H)
	for i := 0; i < H; i++ {
		var tmp string
		fmt.Scanf("%s", &tmp)			

		S[i] = strings.Split(tmp, "")
	}

	var count int
	//Lateral direction
	for i := 0; i < H; i++ {
		for j := 0; j<W-1; j++{
			if S[i][j] == "." && S[i][j+1] == "."{
				count += 1
			}
		}
	}

	//Longitudinal direction
	for j := 0; j<W; j++{
		for i := 0; i < H-1; i++ {
			if S[i][j] == "." && S[i+1][j] == "."{
				count += 1
			}
		}
	}

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

C

Q_C.go


package main

import (
	"fmt"
)

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

	p := [200001] int{}

	min := 0
	var s int
	for i := 0; i<n; i++{
		fmt.Scanf("%d", &s)
		p[s] = 1

		for j:=min; j<2000001; j++{
			if p[min] == 1{
				min ++
			}else{
				fmt.Printf("%d\n", min)
				break
			}
		}
	}
}

D If you remember, I will write it later.

E If you remember, I will write it later.

F If you remember, I will write it later.

Recommended Posts

Notes for HHKB Programming Contest 2020
HHKB Programming Contest 2020
Keyence Programming Contest 2021 Notes
HHKB Programming Contest 2020 Review
AtCoder HHKB Programming Contest 2020 Participation Report
Acing Programming Contest 2020
After "Diverta 2019 Programming Contest"
NOMURA Programming Contest 2020 Review
Installation notes for TensorFlow for Windows
Atcoder Acing Programming Contest Python
Python Tkinter notes (for myself)
Terminology for all programming languages
Tips for data analysis ・ Notes
Python3 standard input for competitive programming
Launch notes for existing Django applications
Basic syntax notes for shell script
Minimum grammar notes for writing Python
Tokio Marine & Nichido Programming Contest 2020 Review
AtCoder Acing Programming Contest 2020 Participation Report
Personal notes for python image processing
For me: Infrastructure and network notes
Notes for challenging basketball video analysis
Notes for me python csv graph
Notes for Python file input / output
LAMMPS command notes (completely for yourself)
AtCoder Keyence Programming Contest 2020 Participation Report
AtCoder Panasonic Programming Contest 2020 Participation Report