HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > CEN111 Homeworks 2013-2015 > problem:


13-Fall2-10. 50379 - a^b modulus k

CEN111 Homeworks 2013-2015

Start: Jan.10.2015 at 10:00:00 AM
Finish: Jan.10.2015 at 03:00:00 PM
The contest is finished!
• Contest scoreboard

Guest
• Review clarifications (2)

Contest problems

• 50389 - Reverse an Array
• 50392 - How much space
• 50378 - Sum of the given digits
• 13-Fall2-10. 50379 - a^b modu...
• 13-Fall2-20. 50399 - Mobile Base Sta...
• 13-Fall2-40. 50401 - Sum of Odd N...
• 13-Fall2-50. 50400 - nth Row rth El...
• 14-Fall1-10. 50532 - Close City
• 14-Fall1-30. 50500 - Find Student
• 14-Fall1-40. 50511 - Class Average
• 14-Fall1-50. 50481 - Car Parking
• 14-Fall2-10. 50510 - What floor are ...

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Question by Ibrahim Mesecan.

a^b modulus k

Question:
Write a program that calculates bth power of a modulus k. For example, if you are asked to calculate 2^6 mod 7; 6th power of 2 is 64 thus 64 modulus 7 is 1.

Input specification
You will be given 3 integers, a, b, and k where b represents the power and k represents the modulus operand and 0 ≤ b ≤ 1000 and 1 < (a and k) ≤ 1000.

Output specification
Show just one integer number which is between 0 and k-1.

Sample Input I   
  2 6 5
Sample Input II   
  3 6 11
Sample Output I   
  4
Sample Output II   
  3


Для отправки решений необходимо выполнить вход.

www.contester.ru