poj1995
来源:互联网 发布:python 量化分析 编辑:程序博客网 时间:2024/06/05 03:50
#include<iostream>#include<cstdio>#include<cstdlib>typedef long long LL;using namespace std; LL pow(LL a,LL p,LL m){ LL d=1,t=a; while(p>0){ if(p&1==1){ d=(d*t)%m; } t=(t*t)%m; p=p>>1; }return d;}int main(){int c,m,h,a,p;LL sum;scanf("%d",&c);while(c--){ sum=0; scanf("%d%d",&m,&h); for(int i=1;i<=h;i++){ scanf("%d%d",&a,&p); sum=(sum+pow(a,p,m))%m; } printf("%d\n",sum); }return 0;}
0 0
- POJ1995
- poj1995
- poj1995
- poj1995
- poj1995
- POJ1995
- poj1995
- POJ1995 Raising Modulo Numbers
- 快速幂-poj1995
- poj1995- 整数快速幂
- poj1995~快速幂水题
- POJ1995 快速幂模版
- poj1995 Raising Modulo Numbers
- POJ1995 快速幂取模
- POJ1995-Raising Modulo Numbers
- 【poj1995】Raising Modulo Numbers
- POJ1995 Raising Modulo Numbers
- poj1995简单快速幂
- 2 类与对象
- NRF51822自学笔记(二)PWM
- android笔记
- poj3090
- 基于vitamio5.0的android播放器
- poj1995
- 设计模式(6)--Bridge 桥接模式
- ScrollView里面的EditText的点击空白处键盘消失的问题
- SSZipArchive使用详解
- 解决ntp的错误 no server suitable for synchronization found
- 一个简单可以设定时间的数据缓存库 (附 源码)
- 关于自定义view时的getDimension的三种写法
- 带权中位数 学习笔记
- Android中资源命名的几点规范