2020-03-01から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…

ABC158

https://atcoder.jp/contests/abc158 過去問。 A:Station and Bus s = gets.chomp puts (s == "AAA" || s == "BBB") ? "No" : "Yes" B:Count Balls n, a, b = gets.split.map(&:to_i) blue_ball = (n / (a + b)) * a remainder = n % (a + b) blue_ball += (…

パナソニックプログラミングコンテスト2020

https://atcoder.jp/contests/panasonic2020 過去問。 A:Kth Term ary = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51] puts ary[gets.to_i - 1] B:Bishop HかWが 1 の場合を忘れていた。 h, w = g…

BunsenLabs Hydrogen apt error

$ lsb_release -a No LSB modules are available. Distributor ID: BunsenLabs Description: BunsenLabs GNU/Linux 8.9 (Hydrogen) Release: 8.9 Codename: bunsen-hydrogen W: 署名照合中にエラーが発生しました。リポジトリは更新されず、過去のインデック…

RubyGem "gdk3" が Linux Mint にインストールできない

Linux Mint 19.3 に gem "gtk3" をインストールしようとしてハマりました。Gem "gdk3" がインストールできない。正解はここ。 $ sudo apt install libgtk-3-devこれでした。

RubyGem "gobject-introspection" が Linux Mint にインストールできない

Linux Mint 19.3 に gem "gtk2" をインストールしようとしてハマりました。 Fetching gobject-introspection 3.4.1 Installing gobject-introspection 3.4.1 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. cu…