Overflow of ans


#1

somebody help me my answer got overflow every time. i calculated sum for a,e,i,o,u and add them like
ans = (a%c + e%c+ i%c + o%c + u%c + c)%c where c is 1e9 + 7


#2

Make your variables long then type cast your ans to int when you return;


#3

Thanks for your reply this problem is from codorbit section problem’s name is Vowels


#4

It is from codersbit so?


#5

i have taken long long type but for A>= 58 long long gets overflow.


#6

i revised my modular arithmetic concepts. and i found my bug. so don’t bother to reply.