poj1995
来源:互联网 发布:下载网络视频的方法 编辑:程序博客网 时间:2024/05/16 06:42
#include<iostream>#include<cstdio>using namespace std;long long PowMod(long long a, long long b, long long c){ long ans =1; a = a%c; while(b > 0) { if(b%2==1) ans = (ans*a)%c; b = b/2; a = (a*a)%c; } return ans;}int main(){ int t; cin >> t; while(t--) { long m, m1, m2, z, x; cin >> m; int n; cin >> n; x = 0; for(int i = 0; i < n; i++) { cin >> m1 >> m2; z = PowMod(m1,m2,m); x = (x+z)%m; } cout << x << endl; }}
- 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简单快速幂
- UVa 146 - ID Codes
- 使用system函数时应该忽略两个信号
- 关于KeyListener的简单使用
- ViewFlipper实现滑动翻页
- Ubuntu 12.10安装Source Navigator
- poj1995
- 剑指offer面试题42翻转单词顺序VS左旋字符串
- hdu2159 FATE
- 两个实用性方法for PHP
- 路由器NAT
- QuickSort
- std::string使用举例
- JDBC操纵数据库的步骤(以SQLServer为例)
- Balanced Binary Tree