Runtime error

on submitting my answer it says runtime error… although it gave the right answer in dev c++
whats the problem???

Uninitialized variables, declaring too large array, out of index exception. These 3 are main causes. For specifics, we need your code and problem link.

Hey @yashkhurana110,

your question goes wrong, as not checking whether are there enough dogs so that every CAT can sit on them.

instead you can find the min and max possible of legs and then compare them to the given legs and whether they are multiple of 4 or not.

If you aren’t able to figure out. you can check this code.

Hope this helps!

There are some basic causes for runtime errors, like:

  1. Array Index out of Bounds - You may be trying to access some index greater than the size of the array or may be using a negative index.
  2. Dividing a Number by zero
  3. Large allocation of memory together/Large Static Memory Allocation.
  4. Maybe you are missing “&” while scanning an integer value using scanf for ex: “scanf("%d",x)
1 Like

He is talking about RE not WA… :stuck_out_tongue: I think he is talking about chef and rainbow array problem…

both got RE, so I assumed his question would for the later one :stuck_out_tongue:

  1. He got WA later, implies he might have resolved RE.
  2. You explained how to resolve WA not RE… :stuck_out_tongue:
  3. After seeing his RE solution, I also feel he wants to know why he got RE first time but WA next time… @yashkhurana110 correct me If I am wrong…
1 Like

great observation skills as always, period. pompous, anyway it doesn’t matter if his query is unanswered than he can comment below and clear his doubt.

1 Like

Oh my… Exasperating farrago of distortions, I wish you would not be so psychotic and narcissist then you could understand my point. BTW it’s “then” not “than” :stuck_out_tongue: , PERIOD.

1 Like