CODEVS3500 Quick Power Entry

Source: Internet
Author: User

CODEVS3500 Quick Power Entry

I'm also a copy of the puzzle.

Title Description Description

Enter 3 number a,b,c, ask A^b mod c=?

Enter a description Input Description

Three numbers a,b,c

Output description Output Description

A number, that is, the answer to A^b MoD c.

Sample input Sample Input

5 10 9

Sample output Sample Output

4

Data range and Tips Data Size & Hint

0<a,b,c<10000000000000000

#include <cstdio>#include<cstring>#include<iostream>using namespacestd;intMiLong Long&a,Long Long&b,Long Long&c) {    Long Longans=1;  while(b>0)    {        if(b&1==1) ans= (ans*a)%C; A= (a*a)%C; b>>=1; } cout<<ans<<Endl;}intMain () {Long LongA,b,c; CIN>>a>>b>>C;    MI (a,b,c); return 0;}

CODEVS3500 Quick Power Entry

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.