Instantly share code, notes, and snippets.

View mediamarker2booklog.R
library("dplyr")
library("stringr")
library("lubridate")
library("readr")
mediamarker %>%
select(
`タイトル`,
ISBN = `ISBN/JAN`,
ASIN = `ASIN(アマゾン商品コード)`,
View mediamarker2bookforward.R
# Media Marker から Bookforward へ
library("dplyr")
library("stringr")
library("lubridate")
library("readr")
library("conflicted")
conflicted::conflict_scout()
View abc094-d.rb
n = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_i)
amax = a.max
amid = amax / 2.0
r = a.sort{|a, b| (a - amid).abs <=> (b - amid).abs}[0]
if n == 2
puts "#{a.max} #{a.min}"
View abc089-d.rb
h, w, d = gets.chomp.split(" ").map(&:to_i)
g = Array.new(h*w+1)
h.times do |i|
row = gets.chomp.split(" ").map(&:to_i)
w.times do |j|
a = row[j]
g[a] = [i, j]
end
end
View code-festival-2018-qualb-b.rb
n, x = gets.chomp.split(" ").map(&:to_i)
ab = []
ans = 0
abmax = [0, 0]
n.times do
a, b = gets.chomp.split(" ").map(&:to_i)
ab << [a, b]
ans += a * b
if b > abmax[1]
abmax = [a, b]
View code-festival-2018-qualb-a.rb
n = gets.chomp.to_i
ans = 0
1.upto(100) do |i|
if i % n == 0
ans += 1
end
end
puts 100 - ans
View abc087-d.rb
# Ref: https://beta.atcoder.jp/contests/abc087/submissions/2036479
n, m = gets.chomp.split(" ").map(&:to_i)
@g = Array.new(n+1){Array.new()}
m.times do
l, r, d = gets.chomp.split(" ").map(&:to_i)
@g[l] << [r, d]
@g[r] << [l, -d]
end
View agc028-a.rb
n, m = gets.chomp.split(" ").map(&:to_i)
s = gets.chomp
t = gets.chomp
l = n.lcm(m)
x = Hash.new(nil)
n.times do |i|
View abc085-d.rb
n, h = gets.chomp.split(" ").map(&:to_i)
a = []
b = []
n.times do
a_, b_ = gets.chomp.split(" ").map(&:to_i)
a << a_
b << b_
end
View abc112-c.rb
n = gets.chomp.to_i
ax = []
ay = []
ah = []
gx, gy, gh = -1, -1, -1
n.times do
x, y, h = gets.chomp.split(" ").map(&:to_i)
ax << x
ay << y