POJ 1995 Raising Modulo Numbers 快速幂
来源:互联网 发布:高仿人民币淘宝支付 编辑:程序博客网 时间:2024/05/16 13:47
题目链接: 点我
题目大意:求
题目分析: 快速幂模板
Problem: 1995 User: ChenyangDuMemory: 152K Time: 110MSLanguage: C++ Result: AcceptedSource Code#include<iostream>#include<cstdio>#include<cstring>using namespace std;int n,MOD;long long mi(long long a,long long b){ long long ans = 1; while(b){ if(b & 1){ ans = (ans*a) % MOD; } a = (a*a) % MOD; b >>= 1; } return ans;}int main(){ //freopen("in.txt","r",stdin); int T; scanf("%d",&T); while(T--){ scanf("%d%d",&MOD,&n); long long ans = 0; for(int a,b,i=1;i<=n;i++){ scanf("%d%d",&a,&b); ans += mi(a,b); ans %= MOD; } printf("%d\n",ans); } return 0;}
阅读全文
0 0
- POJ 1995 Raising Modulo Numbers【快速幂】
- poj 1995 Raising Modulo Numbers 【快速幂】
- POJ 1995:Raising Modulo Numbers 快速幂
- poj 1995 Raising Modulo Numbers【快速幂】
- POJ - 1995 Raising Modulo Numbers 【快速幂】
- |poj 1995|快速幂|Raising Modulo Numbers
- POJ.1995 Raising Modulo Numbers (快速幂)
- POJ 1995 Raising Modulo Numbers 快速幂
- Raising Modulo Numbers 【poj-1995】【快速幂】
- 【POJ 1995】Raising Modulo Numbers(快速幂)
- POJ 1995 Raising Modulo Numbers 快速幂取模
- poj 1995 Raising Modulo Numbers 快速幂取模
- Raising Modulo Numbers (poj 1995 快速幂水题)
- POJ 1995 Raising Modulo Numbers(快速幂取模)
- poj Raising Modulo Numbers 【快速幂 + 模取余】
- poj 1995 Raising Modulo Numbers(快速幂)
- poj 1995 Raising Modulo Numbers 快速模幂
- POJ 1995 Raising Modulo Numbers 整数快速幂
- NTR1czU1bTk=
- Shell分享(二)
- ActionScript3基础语法-变量类型
- Android UI 小红点 可拖拽删除
- 数据结构 — 二叉树的基本操作实现(递归算法)
- POJ 1995 Raising Modulo Numbers 快速幂
- AES加解密
- 重新配置出错eclipse
- poj2389 Bull Math
- linux下安装tomcat8
- MySQL系列—服务器安装与配置
- leetcode 99. Recover Binary Search Tree
- 系统权限管理设计
- Windows10下安装TensorFlow GPU版 及遇到的问题解决办法