I made my program in python for this question. It is working for all cases but still getting WA on submission.
Is it because I am not doing in cpp
As it was mention that answer can exceded 64bit int
But as python is dynamic it cover it up hence giving wrong answers?
Getting Wrong Answer
Please share your code
Hello Rhythm, yes I got your code can you pls tell me about your approach or the idea what you were thinking ?? Language doesn’t matter whether cpp or python both will work.
as you can see code basically what I was trying to do was doning (nCr)/(N/K)
which is further I figured it that it will be equivalent to (n-1)C(r-1)
I runned it for the given sample input it is giving answers but what I think is going wrong that It is in python and in python type of variable do not have a limit that is mentioned in the question with refrence to cpp
Yeah, no doubt the logic is alright but the python is giving division errors.
Just for an ex. take the test case => 160 13
Here the ans is 356159986244258365 but python is giving 356159986244258368 due to some division errors
Okay!!! So, I did guess it right It was python… Well I will reform this code in cpp then… Thanks
I converted my code but still getting wrong answer
C++ would give integer overflow , you need to use an implementation of bigint() class
Okay I will try to go with that
Did it with python… found the potential division error and took my shoot…It worked… Thnks