Ad
  • Default User Avatar

    I agree, the types used in a kata should not depend on one particular compiler implementation. In particular, if you need an integer type that must hold values larger than what fits in 32 bit, it would be better to use one of the fixed-width integer types from cstdint, e.g. int64_t.

  • Default User Avatar

    You are probably solving on 64-bit Windows where long is 32-bit. Codewars runs on 64-bit Linux where long is 64-bit. As a quickfix, you can use long long in your solution. But I agree, this is an issue, C/C++ code on Codewars should never use long as it makes the user experience worse for Windows users.

  • Default User Avatar
    1. 22595200368 != 6540715897. The kata asks for strict equality, not merely enough possible combinatons.
    2. Yes, I agree that x=0 for any m=1 doesn't make much sense for the real-world scenario described. However, if there should be another answer, 1 is clearly wrong (once again, it asks for equality), so then the correct value of x would be x=n