View abc088-d.rb
H, W = gets.chomp.split(" ").map(&:to_i)
$grid = []
blk = 0
H.times do
row = gets.chomp.split("")
row.each do |c|
blk += 1 if c == "#"
end
$grid << row
end
View abc088-c.rb
c = []
csum0 = 0
3.times do
row = gets.chomp.split(" ").map(&:to_i)
csum0 += row.inject(:+)
c << row
end
csum1 = c[0][0] + c[1][1] + c[2][2]
csum2 = c[0][2] + c[1][1] + c[2][0]
View abc088-b.rb
n = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_i).sort.reverse
ans = 0
n.times do |i|
if (i + 1).odd? then
ans += a[i]
else
ans -= a[i]
end
end
View abc088-a.rb
n = gets.chomp.to_i
a = gets.chomp.to_i
b = n % 500
if b <= a then
puts "Yes"
else
puts "No"
end
View future2018-qual.rb
n = 100
a = []
100.times do
r = gets.chomp.split(" ").map(&:to_i)
a += r
end
ret = []
1000.times do
amax = a.max
h = [n, amax].min
View apc001-a.rb
x, y = gets.chomp.split(" ").map(&:to_i)
if x % y == 0 then
puts -1
exit
end
n = x * y + x
if n > 10**18 then
View apc001-b.rb
n = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_i)
b = gets.chomp.split(" ").map(&:to_i)
sum_a = 0
sum_b = 0
cnt_a = 0
cnt_b = 0
n.times do |i|
if a[i] < b[i] then
View abc080-c.rb
# ABC080
# C. Shopping Street
n = gets.chomp.to_i
f_ = []
n.times do
f_ << gets.chomp.split(" ").map(&:to_i)
end
View abc084-c.rb
# ABC084
# C. Special Trains
n = gets.chomp.to_i
c = []
s = []
f = []
(n-1).times do
c_, s_, f_ = gets.chomp.split(" ").map(&:to_i)
c << c_
View abc078-c.rb
# ABC078
# C. HSI
n, m = gets.chomp.split(" ").map(&:to_i)
puts (1900 * m + 100 * (n - m)) * 2**m