@above Better you ask it on spoj forum
On Sun, Jun 19, 2011 at 7:27 PM, saurabh singh saurab...@gmail.com wrote:
I am getting WA for this problem.I dont know whether its case of overflow
or I have come up with a wrong formula,
https://www.spoj.pl/problems/CHAIR/
I am coding in python so I dont think there is probblem of overflow.
def f(n):
if n0:
return 0
if n==0:
return 1
i=n
prod=1
while i0 :
prod*=i
i-=1
return prod
n=input()
k=input()
if k==1:
print n
elif 2*kn:
print 0
else :
x=f(n-1)
y=f(n-k)*f(k)
print (x-y)%13
--
Saurabh Singh
B.Tech (Computer Science)
MNNIT ALLAHABAD
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.