Submission #2707970


Source Code Expand

array = gets.split(" ").map(&:to_i)
biskets = gets.split(" ").map(&:to_i)
evens = []
odds = []
biskets.each do |i|
  if i.even?
    evens << i
  else
    odds << i
  end
end
sum_e = 0
sum_o = 0  
odds.length.step(0,-1) do |i|
  child = 1
  mother = 1
  i.times do |num|
    child *= (odds.length - num)
    mother *= (num + 1)
  end
  if i.even?
    sum_e += (child / mother)
  else
    sum_o += (child / mother)
  end
end
if array[1].even?
  puts sum_e * (2 ** evens.length)
else
  puts sum_o * (2 ** evens.length)
end

Submission Info

Submission Time
Task A - Biscuits
User hironobu
Language Ruby (2.3.3)
Score 200
Code Size 549 Byte
Status AC
Exec Time 7 ms
Memory 1788 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 4
AC × 16
Set Name Test Cases
Sample sample1.txt, sample2.txt, sample3.txt, sample4.txt
All sample1.txt, sample2.txt, sample3.txt, sample4.txt, in1.txt, in2.txt, in3.txt, in4.txt, in5.txt, in6.txt, in7.txt, in8.txt, sample1.txt, sample2.txt, sample3.txt, sample4.txt
Case Name Status Exec Time Memory
in1.txt AC 7 ms 1788 KB
in2.txt AC 7 ms 1788 KB
in3.txt AC 7 ms 1788 KB
in4.txt AC 7 ms 1788 KB
in5.txt AC 7 ms 1788 KB
in6.txt AC 7 ms 1788 KB
in7.txt AC 7 ms 1788 KB
in8.txt AC 7 ms 1788 KB
sample1.txt AC 7 ms 1788 KB
sample2.txt AC 7 ms 1788 KB
sample3.txt AC 7 ms 1788 KB
sample4.txt AC 7 ms 1788 KB