Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
What a horrible kata, are we expected to count here instead of using combinatorics? Edit: nvm, we have to take into account nonsensical input.
Intermediate results are too big for
ull
. Try a different algorithm to compute the same value.Yes, even the sample tests take 3 seconds to complete.
just noticed this, you are attempting to multiply incorrectly.
n(i+1)
should ben * (i + 1)
Use the
question
label next time when asking for help. Also please format you code properly when posting here.I checked your code and noticed 2 issues:
1:
vector variable
is not a valid declaration: use vector<...> var ( I don't do much c++, but I believe it's mandatory )2: You're not looking after
n
variable. If your condition succeds, what should happen ton
?I hope this helps.
Sorry, issues are for problem in the kata not for problem in your code (notice at the top of the page how many people passed the kata and the C++ translation). Cheers.