Ad
  • Custom User Avatar

    What a horrible kata, are we expected to count here instead of using combinatorics? Edit: nvm, we have to take into account nonsensical input.

  • Default User Avatar

    Intermediate results are too big for ull. Try a different algorithm to compute the same value.

  • Default User Avatar

    Yes, even the sample tests take 3 seconds to complete.

  • Default User Avatar

    just noticed this, you are attempting to multiply incorrectly. n(i+1) should be n * (i + 1)

  • Custom User Avatar

    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 to n ?

    I hope this helps.

  • Default User Avatar

    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.