2020-03-26から1日間の記事一覧

ABC159

https://atcoder.jp/contests/abc159 過去問。 A: The Number of Even Pairs 偶数から2個か奇数から2個取ればよい。 #x個の中から2個取る組み合わせの数 def c(x) return 0 if x == 0 || x == 1 x * (x - 1) / 2 end n, m = gets.split.map(&:to_i) puts c(n…