# DCP-23: Another Bigmod Problem Back to All Problems

Hard Math > Modular Arithmetic

Given A, B and C, find the value of (A^B)%C. Input: ------ First line will contain a single integer T (T<1000) indicating number of test case. After that, T lines will follow with three positive integers A, B and C. (A,B,C<=10^18) Output: ------- For each test case, print a single line containing the case number and the value of (A^B)%C. See the sample case. Sample Input ------------ 3 12 43 123 1231 123 1000 12345 123456789 123456789012345 Sample Output ------------- Case 1: 6 Case 2: 991 Case 3: 59212459031520

### Problem Limits

 Language Time Limit (seconds) C/C++ 1.00 Java 2.00 C# 2.00 PHP 2.00

# 106/306

Solve/Submission

### Ranking

# User Language Timing
01 duronto20 Cpp 0.06s
02 tariqiitju Cpp 0.06s
03 rayhan50001 Cpp 0.07s
04 mamunparvez Cpp 0.08s
05 seyedssz Cpp 0.09s
06 sakib_muhit Cpp 0.11s
07 haasib Cpp 0.11s
08 ash12 Cpp 0.12s
09 Nusaiba Cpp 0.13s
11 Ishrak Cpp 0.19s
12 anik_JU Cpp 0.22s
13 Pure_Protea Cpp 0.25s
14 maxhasan Cpp 0.25s
15 jayed_al_hasan Cpp 0.26s
16 emrul Cpp 0.27s
17 md_borhan Cpp 0.32s
18 Robinsoncruso Cpp 0.32s
19 mhiceiuk Cpp 0.33s
20 nasif2587 Cpp 0.38s
21 yasirnabil534 Cpp 0.40s
22 liar Cpp 0.41s
23 Zeronfinity Cpp 0.43s
24 swapnil Cpp 0.43s
25 anowar1112 Cpp 0.45s
26 ImagineWarrior Cpp 0.47s
27 prantacse14 Cpp 0.48s
28 ahqmrf Cpp 0.48s
29 drifter Cpp 0.49s
30 jayanto Cpp 0.49s
31 froghramar Cpp 0.50s
32 SKL12 Cpp 0.50s
33 ssavi Cpp 0.51s
34 Koushik_12 Cpp 0.51s
35 as_couple Cpp 0.52s
36 nazmulasha Cpp 0.54s
37 rashed_cse Cpp 0.58s
38 Masum_ice Cpp 0.60s
39 Unseen Cpp 0.62s
40 Islam_Rafat Cpp 0.62s
41 NOxBODY Cpp 0.64s
42 KIRIN_36 Cpp 0.65s
44 Zexon Cpp 0.66s