题目链接

题目:

题解:很简单、经典的的一道快速幂的题 注意一下用LL型就ok。

代码:

 1 #include <map>
2 #include <set>
3 #include <list>
4 #include <stack>
5 #include <queue>
6 #include <deque>
7 #include <cmath>
8 #include <ctime>
9 #include <string>
10 #include <limits>
11 #include <cstdio>
12 #include <vector>
13 #include <iomanip>
14 #include <cstdlib>
15 #include <cstring>
16 #include <istream>
17 #include <iostream>
18 #include <algorithm>
19 #define ci cin
20 #define co cout
21 #define el endl
22 #define Scc(c) scanf("%c",&c)
23 #define Scs(s) scanf("%s",s)
24 #define Sci(x) scanf("%d",&x)
25 #define Sci2(x, y) scanf("%d%d",&x,&y)
26 #define Sci3(x, y, z) scanf("%d%d%d",&x,&y,&z)
27 #define Scl(x) scanf("%I64d",&x)
28 #define Scl2(x, y) scanf("%I64d%I64d",&x,&y)
29 #define Scl3(x, y, z) scanf("%I64d%I64d%I64d",&x,&y,&z)
30 #define Pri(x) printf("%d\n",x)
31 #define Prl(x) printf("%I64d\n",x)
32 #define Prc(c) printf("%c\n",c)
33 #define Prs(s) printf("%s\n",s)
34 #define For(i,x,y) for(int i=x;i<y;i++)
35 #define For_(i,x,y) for(int i=x;i<=y;i++)
36 #define FFor(i,x,y) for(int i=x;i>y;i--)
37 #define FFor_(i,x,y) for(int i=x;i>=y;i--)
38 #define Mem(f, x) memset(f,x,sizeof(f))
39 #define LL long long
40 #define ULL unsigned long long
41 #define MAXSIZE 100005
42 #define INF 0x3f3f3f3f
43
44 LL mod;
45 const double PI = acos(-1.0);
46
47 using namespace std;
48 void power(LL a,LL b)
49 {
50 LL ans=1%mod;
51 while(b)
52 {
53 if(b&1)
54 ans=a*1ll*ans%mod;
55 a=a*1ll*a%mod;
56 b>>=1;
57 }
58 cout << ans;
59 }
60 int main()
61 {
62 int a,b;
63 cin>>a>>b>>mod;
64 power(a,b);
65 return 0;
66 }

最新文章

  1. 算法与数据结构(十五) 归并排序(Swift 3.0版)
  2. 前端开发--评论区抓bug
  3. expdp 报The value (30) of MAXTRANS parameter ignored错误的原因诊断
  4. mysql&#160;explain用法和结果的含义
  5. ML 06、感知机
  6. cocos2d-x之Vector与map
  7. 小蔡计算器 V4.0新版全新发布上线啦~欢迎大家下载使用哈~
  8. 解决方案:安装wordpress出现500 Internal Server Error
  9. Android开发艺术探索(三)——View的事件体系
  10. 使用read(),write(),seekg(),seekp()实现二进制方式文件随机存取
  11. hdu3278Puzzle
  12. 修改LibreOffice Draw中定义的样式名称
  13. sql server 分区(上)
  14. python_getpass 模块的使用
  15. windows+mysql集群搭建-三分钟搞定集群
  16. CF895C: Square Subsets &amp;&amp; 【BZOJ2844】albus就是要第一个出场
  17. Using the G711 standard
  18. UVa LA 2965 - Jurassic Remains 中间相遇,状态简化 难度: 2
  19. The writing on the wall
  20. 20155206赵飞 Exp1PC平台逆向破解及Bof基础实践

热门文章

  1. ArcObjects SDK开发 003 宏观角度看ArcObjects SDK
  2. 实践案例:同程艺龙网的 Dubbo 升级经验总结
  3. MyBatis01:框架概述、环境搭建及入门案例、自定义框架
  4. vue3 watch笔记
  5. 浏览器DevTools使用技巧
  6. 我今天吃了SHI,请对下联
  7. 前端知识之JS(javascirpt)
  8. python之元组(tuple)知识点
  9. 正确理解和使用JAVA中的字符串常量池
  10. HBase详解(01) - Hbase简介