The second-party evaluation model

Source: Internet
Author: User

Time limit of the second-order modulus: +Ms | Memory Limit:65535KB Difficulty:3
Describe

The value of the B-square to the C-remainder of a

Input
The first line enters an integer n indicates the number of groups of test data (n<100)
Only one row per group of tests, with three positive integers a,b,c (1=<a,b,c<=1000000000)
Output
The result of the
B-side of output A to the C-remainder
Sample input
32 3 53 100 1011 12345 12345
Sample output
3110481
Source
[Zhang Yunzun] Original
Uploaded by

Zhang Yunzun

Reference: http://acm.nyist.net/JudgeOnline/talking.php?pid=102 56 Floor

I don't know why I do this, remember ~

#include <iostream> #include <stdio.h>using namespace std;int dy (int m,int n,int p) {if (n==0) return 1%p;int Temp=dy (m,n>>1,p); temp= (Long Long) temp*temp%p;if (n&1) temp= (long long) Temp*m%p;return temp;} int main () {int t,m,n,p;cin>>t;    while (t--) {       cin>>m>>n>>p;   Cout<<dy (M,n,p) <<endl;} return 0;}        

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

The second-party evaluation model

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.