Блог пользователя 8shubham

Автор 8shubham, история, 9 лет назад, По-английски

While solving this question on spoj when I am declaring array as long long I am getting SIGFPE Runtime error and as soon as I change it to int, it is getting accepted.

Error Code

ACed Code

I am unable to understand why this is happening because SIGFPE error occurs when we divide by zero.

Can anyone help on it ?

  • Проголосовать: нравится
  • +3
  • Проголосовать: не нравится

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

the size of your fact array is too small, increasing it and computing the right value would make it AC. The UB bug occurs as count[i]>>1 can be greater than 25.