AtCoder Beginner Contest 181 Note

Preface

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

problem

https://atcoder.jp/contests/abc181

A

Q_A.go


package main

import (
    "fmt"
)

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

    if n % 2 == 0{
        fmt.Printf("White")
    }else{
        fmt.Printf("Black")
    }
	
}

B

Q_B.go


package main

import (
	"fmt"
)

func main() {
    var n int
    fmt.Scanf("%d", &n)
	
	var a, b int64
	var result int64
	for i := 0; i < n; i++ {
		fmt.Scanf("%d %d", &a, &b)	
		result += (b+a)*(b-a+1)/2
	}

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

C

Q_C.go


package main

import (
	"fmt"
)

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

	point := make([][]int64, n)
	for i := 0; i < n; i++ {
		point[i] = make([]int64, 2)
		fmt.Scanf("%d %d", &point[i][0], &point[i][1])
	}

	var result bool = false
	for i:=0; i<n; i++{
		for j:=i+1; j<n; j++{
			for k:=j+1; k<n; k++{

				a_b := (point[j][1] - point[i][1]) * (point[k][0] - point[i][0])
				a_c := (point[k][1] - point[i][1]) * (point[j][0] - point[i][0])

				b_a := (point[i][1] - point[j][1]) * (point[k][0] - point[j][0])
				b_c := (point[k][1] - point[j][1]) * (point[i][0] - point[j][0])

				c_a := (point[i][1] - point[k][1]) * (point[j][0] - point[k][0])
				c_b := (point[j][1] - point[k][1]) * (point[i][0] - point[k][0])

				if (a_b == a_c) || (b_a == b_c) || ( c_a == c_b){
					result = true
				}
			}
		}
	}

	if result {
		fmt.Printf("Yes\n")
	} else {
		fmt.Printf("No\n")
	}
}

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

AtCoder Beginner Contest 181 Note
AtCoder Beginner Contest 187 Note
AtCoder Beginner Contest 180 Note
AtCoder Beginner Contest 182 Note
AtCoder Beginner Contest 183 Note
AtCoder Beginner Contest 184 Note
AtCoder Beginner Contest 188 Note
AtCoder Beginner Contest # 003 Participation Note
AtCoder Beginner Contest 177
AtCoder Beginner Contest 179
AtCoder Beginner Contest 172
AtCoder Beginner Contest 180
AtCoder Beginner Contest 173
Atcoder Beginner Contest 153
AtCoder Beginner Contest 152 Review
AtCoder Beginner Contest 160 Review
AtCoder Beginner Contest 178 Review
ACL Beginner Contest Note
AtCoder Beginner Contest 166 Review
AtCoder Beginner Contest 167 Review
AtCoder Regular Contest 106 Note
AtCoder Beginner Contest 164 Review
AtCoder Beginner Contest 169 Review
AtCoder Beginner Contest 181 Review
AtCoder Beginner Contest 171 Review
AtCoder Beginner Contest 182 Review
AtCoder Beginner Contest 180 Review
AtCoder Beginner Contest 156 WriteUp
AtCoder Beginner Contest 177 Review
AtCoder Beginner Contest 168 Review
AtCoder Regular Contest 105 Note
AtCoder Beginner Contest 179 Review
Solve AtCoder Beginner Contest 100-102
AtCoder Beginner Contest 167 Memorandum
AtCoder Beginner Contest 172 Review
AtCoder Beginner Contest 176 Review
AtCoder Beginner Contest 175 Review
AtCoder Beginner Contest 174 Review
AtCoder Beginner Contest 153 Review
AtCoder Beginner Contest 156 Review
AtCoder Beginner Contest 161 Review
AtCoder Beginner Contest 170 Review
AtCoder Beginner Contest 165 Review
AtCoder Beginner Contest 173 Review
AtCoder Beginner Contest 155 Review
AtCoder Beginner Contest 162 Review
AtCoder Beginner Contest 181 Participation Report
AtCoder Beginner Contest 175 Virtual entry
AtCoder Beginner Contest 161 Participation Report
AtCoder Beginner Contest 151 Participation Report
AtCoder Beginner Contest 176 Participation Report
AtCoder Beginner Contest 154 Participation Report
AtCoder Beginner Contest 166 Participation Report
AtCoder Beginner Contest 153 Participation Report
AtCoder Beginner Contest # 002 C Problem
AtCoder Beginner Contest 145 Participation Report
AtCoder Beginner Contest 184 Participation Report
AtCoder Beginner Contest 165 Participation Report
AtCoder Beginner Contest 160 Participation Report
AtCoder Beginner Contest 169 Participation Report
AtCoder Beginner Contest 178 Participation Report