HDU 1420 prepared for new acmer (math)

Source: Internet
Author: User

Question link: http://acm.hdu.edu.cn/showproblem.php? PID = 1, 1420


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


The Code is as follows:

 
# Include <cstdio> int main () {_ int64 t; _ int64 A, B, C; scanf ("% i64d", & T); While (t --) {scanf ("% i64d % i64d % i64d", & A, & B, & C); _ int64 ans = 1; for (INT I = 0; I <B; I ++) {ans * = A; ans % = C;} printf ("% i64d \ n", ANS);} return 0 ;}


HDU 1420 prepared for new acmer (mathematical problem)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.