Windows 11 が発表されてから、ずっと気になっていました。 今日(2021年10月5日)から、Windows 11 アップグレードが解禁されたので早速 Windows 11 にアップグレードしました。
天下一 2021 autumn Go言語
天下一 Game Battle Contest 2021 Springに初参加しました。
Problem Reversort Note: The main parts of the statements of the problems "Reversort" and "Reversort Engineering" are identical, except for the last paragraph. The problems can otherwise be solved independently. Reversort is an algorithm to sort a list of distinct integers in increasing order. The algorithm is based on the "Reverse" operation. Each application of this operation reverses the order of some contiguous part of
AtCoder Beginner Contest 196 solutions with Golang
Go言語でソート ソートしたい配列(スライス)をaとする。aの要素は、すべてint型とする。 1.昇順sort.Sort(sort.IntSlice(a)) 2.降順sort.Sort(sort.Reverse(sort.IntSlice(a))) 練習問題 [B - Card Game for Two](https://atcoder.jp/contests/abc088/tasks/abc088_b) package main import ( "fmt" "sort" ) func main() { var n int fmt.Scan(&n) a := make([]int, n) for i := 0; i < n; i++ { fmt.Scan(&a[i]) } sort.Sort(sort.Reverse(sort.IntSlice(a))) var t, u int for i := 0; i < n; i++ { if i%2 == 1 { t += a[i] } else { u += a[i] } } fmt.Println(u - t) } 参考 https://golang.org/pkg/sort