UESTC 1548 高次幂
来源:互联网 发布:知乎每日精选 知乎日报 编辑:程序博客网 时间:2024/06/05 14:30
直接代公式。。。
ACcode:
#include<cstdio>#include<cstring>typedef long long LL;const int MOD=1000000007;int b,c;LL a,ans,flag;LL quick_pow(LL x,int y,int mod){ LL res=1; while (y) { if (y&1) res*=x; x*=x; if (x>=mod) x%=mod,flag=1; if (res>=mod) res%=mod,flag=1; y>>=1; } if (res>=mod) res%=mod,flag=1; return res;}int main(){ while (~scanf("%lld %d%d",&a,&b,&c)) { flag=0; b=quick_pow((LL)b,c,MOD-1); a=quick_pow(a,b+(MOD-1)*flag,MOD); printf("%lld\n",a); } return 0;}
- UESTC 1548 高次幂
- UESTC
- UESTC
- UESTC
- UESTC
- UESTC
- UESTC
- UESTC
- UESTC
- UESTC
- UESTC
- UESTC
- UESTC
- UESTC
- UESTC
- UESTC
- UESTC
- UESTC
- 如何成为一个C++高级程序员
- JDBC工作原理
- 强类型语言、弱类型语言
- Windows下使用批处理设置IP地址
- 使用JSON JavaScriptSerializer 进行序列化或反序列化时出错。字符串的长度超过了为 maxJsonLength属性
- UESTC 1548 高次幂
- 服务器“推”技术
- cloudfoundry 2.0 on CentOS 6 小结
- 十个JDBC的最佳实践
- Android Bluetooth
- warden及平台安全
- std::cout和printf
- RMAN Restore Database Slow / How To Improve RMAN Restore Performance [ID 467694.1]
- 黑马程序员:Java基础总结----异常