My first ICPC problem : Powers Et Al
When my friend told me to try competing in ICPC, I searched on the internet to find what kinds of questions are asked. "Powers Et Al" was the first one I found and then I tried it. You can read the question here.
Question is very straightforward. Given two non-negative numbers m and n , you will have to find the last digit of (m)n. It looks like easy to do. Then I found that the limits of m and n can go from 0 to less than (10)101. So it means something like m=3171289472189479798 and n=364839642389643289 can appeaer in the input. Then the last digit of (3171289472189479798)364839642389643289 needs to be calculated.
It makes the problem hard to solve and it takes me a week to get a solution.I have put my solution at the end of the post.But before you check that, you should try to think by yourself.
You can also see the solution in my github account.
Comments
Post a Comment