How to solve this problem:
https://www.codechef.com/ENCI2018/problems/ENCPH1/
PS: No editorial present for this
How to solve this problem:
https://www.codechef.com/ENCI2018/problems/ENCPH1/
PS: No editorial present for this
Hence u have to find
##(1^k)%1000 to (1000^k)%1000 And store it in an array of size 1000
And print last three digits of it that is the answer…
#Note:- please use O(log(n)) approach with modulo for power function… inbuilt power function won’t work…
i.e last three digits of.
1^k = 1001^k ,
2^k = 1002^k ,
3^k = 1003^k (only last three digits),…
So u can only calculated those first 1000 numbers and based on them further numbers could be obtained easily…
Thanks…
Thanks man!
Welcome
Advice :- Try to keep everything in long long as type casting problem would give wrong answers
PS:- my personal experience