Hangzhou Electric HDU ACM 1420 Prepared for New Acmer

Source: Internet
Author: User

Prepared for New Acmer Time limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)
Total submission (s): 7255 Accepted Submission (s): 2729


Problem description training for nearly 2 weeks, this period of time with the rehabilitation of the main, I have been closely monitoring the training situation, so far, the performance of the people are very satisfied, first of all, the majority of the players are highly motivated, followed by the training discipline, and finally, The old team also played a very good lead role, here special thanks for the DP special practice game to provide the topic and test data of the training team captain Xhd classmate.

Especially happy is, follow training team training of a group of new players performance is very good, progress is more significant, especially the training attitude greatly exceeded my expectations, I dare say, if you can so persist, absolutely promising!

Considering that the new players have not yet been trained, I will add a simple question here:
Given three positive integers, a, B, and C (a,b,c<=1000000), the result of A^b MoD C is obtained.

I hope you can experience the joy of AC in the game, absolutely tailor-made, very high treatment yo, hehe ...

Input data first contains a positive integer n, representing the number of test instances, followed by n rows of data, each containing three positive integer a,b,c.

Output for each test instance, export the computed results, one row for each instance.

Sample Input
32 3 43 3 54 4 6

Sample Output
024

Authorlcy
The source initially feels like it should not cross the border. In fact for this group: there is a negative result, so use--int64;
#include <iostream>using namespace Std;int main () {int a,b,c;int n;cin>>n;while (n--) {cin>>a>> B>>c;int sum=1;for (int i=1;i<=b;i++) {sum*=a;sum%=c;if (sum==0) break;} Cout<<sum<<endl;} return 0;}

Hangzhou Electric HDU ACM 1420 Prepared for New Acmer

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.