A King's problem

Computer Science Level pending

Once again, the great and mighty King of Swadia, absolute ruler of his kingdom, is bored. In such moments, the King tends to annoy his advisers with bunch of hard and unnecessary problems. For today, King made quite a nice problem. He will give two number, first \( A \), then \( B \), and he wants to know two last digits of number \( A^{B} \).

Of course, the King will give more such pairs and he wants a solution to all of them. The first man who will accomplish this task, will be given a lot of gold, mead and some other privileges.

However, a smart man named Billy already solved this, so he gets all the privileges. But if You correctly solve this task, you will earn certain amount of brilliant points.


Input is done through file "King.txt". First number represents how many questions will be. Question is asked with two numbers, first number \( A \), then \( B \). Answer to such question is \( A^{B} \mod 100 \). Find the sum of all such answers.

Some details and guarantees:

  • In each question, numbers will be taken from \( [ 0, 2^{30} ] \).
  • There will be no questions which will ask for \( 0^{0} \)
  • File can be downloaded from here, as well.


\( 11^{15} = 41772481694156\underline{51}; \space 134^{5} = 432040034\underline{24}; \space 7^{10} = 2824752\underline{49} \)

\(51 + 24 + 49 = 124 \)

\( \)

\( \)


Questions related to this problem can be asked here.


Problem Loading...

Note Loading...

Set Loading...