View colopl2018-qual-b.rb
n, x = gets.chomp.split(" ").map(&:to_i)
s = gets.chomp
tt = []
n.times do
tt << gets.chomp.to_i
end
ans = 0
n.times do |i|
if s[i] == '0' then
ans += tt[i]
View code-thanks-fes-2017-para-b.rb
s = gets.chomp
ss = s.reverse
ans = ss.length
ss.length.times do |i|
sss = s + ss[i..-1]
if sss == sss.reverse then
ans = ss.length - i
end
end
View agc004-a.rb
a, b, c = gets.chomp.split(" ").map(&:to_i)
total = a * b * c
r1 = (a / 2) * b * c
b1 = total - r1
r2 = a * (b / 2) * c
b2 = total - r2
r3 = a * b * (c / 2)
View abc089-a.rb
a, b, c = gets.chomp.split(" ").map(&:to_i)
if a + b >= c then
puts "Yes"
else
puts "No"
end
View abc089-b.rb
# https://beta.atcoder.jp/contests/abc089/submissions/2210616
gets
n = gets.chomp.split(" ").uniq.length
if n == 3 then
puts "Three"
else
puts "Four"
end
View dwacon2018-prelims-a.rb
# https://beta.atcoder.jp/contests/dwacon2018-prelims/tasks/dwacon2018_prelims_a
s = gets.chomp
if s[0] == s[2] && s[1] == s[3] then
puts "Yes"
else
puts "No"
end
View tenka1-2016-qualb-a.rb
def f(n)
((n**2 + 4) / 8.0).floor
end
puts f(f(f(20)))
View colopl2018-qual-a.rb
a, b = gets.chomp.split(" ").map(&:to_i)
s = gets.chomp
if s.length >= a && s.length <= b then
puts "YES"
else
puts "NO"
end
View code-thanks-festival-2017-open-a.rb
a = []
8.times do
a << gets.chomp.to_i
end
puts a.max
View abc089-a.rb
n = gets.chomp.to_i
puts n / 3