HDU 1420 Prepared for New Acmer [China residue theorem], hduacmer
/*
Solution: China residual theorem. Pay attention to the data type and use the _ int64-bit
Problem solving person: lingnichong
Solution time: 06:56:35
Experience in solving problems: simple questions
*/
Prepared for New AcmerTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission (s): 6361 Accepted Submission (s): 2405
The Problem Description training lasted for nearly two weeks. During this period, we focused mainly on recoverability training. I have been paying close attention to the training situation. So far, I have been quite satisfied with your performance, first, most of the team members are very enthusiastic about training, and secondly, they observe the discipline of training. Finally, the old team members also played a very leading role, I would like to thank xhd, the training team leader who provided questions and test data for this DP special exercise competition.
I'm particularly pleased that a group of new players trained by the training team have performed very well and made remarkable progress. Especially, the training attitude has greatly exceeded my expectation. I dare say, if you can stick to it like this, there is no way ahead!
Considering that new players have not been trained in the system, I will add a simple question here:
Returns the result of A ^ B mod C given three integers A, B, and C (A, B, C <= 1000000.
I hope all of you will be able to see the joy of AC in the competition, absolutely tailored, and enjoy a high level of treatment...
Input data first contains A positive integer N, indicating the number of test instances, followed by N rows of data, each line contains three positive integers A, B, C.
Output outputs the computation results for each test instance. The Output of each instance occupies one row.
Sample Input
32 3 43 3 54 4 6
Sample Output
024
Authorlcy
#include<stdio.h>int main(){int n,i;__int64 a,b,c,sum;scanf("%d",&n);while(n--){sum=1;scanf("%I64d%I64d%I64d",&a,&b,&c);for(i=1;i<=b;i++)sum=(sum%c*a%c)%c; printf("%I64d\n",sum);}return 0;}