as in this question all variables are in 10 power 5 still code does not work if i didnot declare them only int
How to decide whetther to give variables long long int or simple int
@shakul
Range of int is roughly -10^9 to +10^9 while that of long long int is -10^18 to + 10^18. So if you need to store values larger than 10^9 or lesser than -10^9 , you should use long long int .
Even though the values provided in the problem can all be stored in int as per the constraints , our final answer is a sum of products. This final value will get pretty large and cannot be stored in range of int. Morevoer , if you take int for your variables your computations are done considering int only and in case of overflow , the value becomes negative. Which is why its better to take long long int to avoid such complications.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.