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.
I am unable to understand why this is happening because SIGFPE error occurs when we divide by zero.
Can anyone help on it ?
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.But see my ACed solution I have changed nothing just the cnt array from ll to int and everything seems to be working fine. I am not able to understand. How the array type can lead to SIGFPE error ?
well, I think the UB bug coincidentally get you AC. I am not sure as I don't have access to the inputs. But your AC code is definitely not correct as it does not count 25! and above correctly
Ok.. This might be the case as I was continuously getting this error so I referred to CODE to verify my ans.(He has also done the same thing)
You are correct this is not the right method. BTW thanks !!