Submission #6368622


Source Code Expand

n,k = gets.chomp.split(" ").map(&:to_i)

@h = {}
(0..2000).each do |n|
  @h[n] = 1;next if n == 0
  @h[n] = @h[n-1]*n
end

def f(number)
  @h[number]
end

def c(n,k)
  return 1 if n == 0 or k == 0
  return 0 if n < k
  f(n) /(f(n-k)*f(k))
end
k.times do |i|
  i+=1
  puts c(n-k+1, i)*c(k-1, i-1) % 1000000007
end

Submission Info

Submission Time
Task D - Blue and Red Balls
User rk018
Language Ruby (2.3.3)
Score 400
Code Size 332 Byte
Status AC
Exec Time 95 ms
Memory 8060 KiB

Compile Error

./Main.rb:4: warning: shadowing outer local variable - n

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 2
AC × 14
Set Name Test Cases
Sample 01.txt, 02.txt
All 01.txt, 02.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt
Case Name Status Exec Time Memory
01.txt AC 10 ms 4092 KiB
02.txt AC 10 ms 4092 KiB
11.txt AC 10 ms 4092 KiB
12.txt AC 10 ms 4092 KiB
13.txt AC 10 ms 4092 KiB
14.txt AC 10 ms 4092 KiB
15.txt AC 10 ms 4092 KiB
20.txt AC 10 ms 4092 KiB
21.txt AC 53 ms 6652 KiB
22.txt AC 93 ms 8060 KiB
23.txt AC 95 ms 8060 KiB
24.txt AC 11 ms 4092 KiB
25.txt AC 43 ms 6268 KiB
26.txt AC 58 ms 6908 KiB