https://ideone.com/YX4Uyj ---->solution link
https://www.codechef.com/COOK101B/problems/YVNUM ---->question link
Not able to understand where to take mod in the code.Code is running fine for smaller inputs
https://ideone.com/YX4Uyj ---->solution link
https://www.codechef.com/COOK101B/problems/YVNUM ---->question link
Not able to understand where to take mod in the code.Code is running fine for smaller inputs
See, long long data type can store number with max of 18 digits. And |N| = 10^5, so this logic will surely not work.
HINT:
Hope this helps. It is too confusing. Do let me know in case of any doubts.
https://ide.codingblocks.com/s/46940
Here is my submission for your reference. It is too confusing, so try yourself and let me know in case of any doubts.