Skip to main content
7 of 10
Remove "--FIXED--" from header

Ruby - 160 Chars

Using recursion an the fact that for this recursive function, cos(x, n) = 1 + sin(x, n + 1)

def p(x,n)n<1?1:x*p(x,n-1)end
def f(n)n<2?1:n*f(n-1)end
def c(x,n)n<1?1:p(x,n)/f(n)-c(x,n-2)end
x,n=gets.split.collect{|i|i.to_f}
n*=2
puts c(x,n-1)+1,c(x,n-2)