HDU 2035 快速幂取模
来源:互联网 发布:Python log日志的级别 编辑:程序博客网 时间:2024/04/29 13:26
HDU 2035
题解 : 模板题, 快速幂入门.
code:
/*adrui's submissionLanguage : C++Result : AcceptedLove : llFavorite : Dragon BallsStanding in the Hall of Fame*/#include<cstdio>#include<cstring>#include<algorithm>#include<queue>#include<iostream>#include<bitset>#include<map>using namespace std;#define M(a, b) memset(a, b, sizeof(a))#define mid ((l + r) >> 1)#define ls rt << 1, l, mid#define rs rt << 1|1, mid + 1, r#define lowbit(x) (x & (-x))#define LL long long#define REP(n) for(int i = 1; i <= n; i++)#define debug 0#define mod 1000int n, m;int fast_multi(int a, int b) {int ans = 0;while (b) {if (b & 1) ans = (ans + a) % mod;a = (a + a) % mod;b >>= 1;}return ans;}int fast_mod() {int res = 1;while (m) {if (m & 1) res = fast_multi(res, n);n = fast_multi(n, n);m >>= 1;}return res;}int main() {#if debugfreopen("in.txt", "r", stdin);//freopen("out.txt", "w", stdout);#endif //debugwhile (~scanf("%d%d", &n, &m), n + m) {printf("%d\n", fast_mod());}return 0;}
1 0
- HDU 2035 快速幂取模
- 【快速幂取模】HDU 2035---人见人爱A^B
- HDU 2035 人见人爱A^B (快速幂取模)
- HDU 2035 人见人爱A^B 快速幂取模
- 快速幂 hdu 2035
- HDU 2035 快速幂
- hdu 3003 快速幂取模
- HDU 1061(快速幂取模)
- hdu 1061 快速幂取模!!!!!
- hdu 1905 快速幂取模
- hdu 1061 快速幂取模
- HDU 1061 快速幂取模
- HDU 1097 快速幂取模
- <快速幂模> HDU 2035
- hdu 2035快速幂解法
- hdu-1097快速幂取模运算
- hdu 1601(快速幂取模)
- HDU—2035—人见人爱A^B—【快速幂取模】
- leetcode--22--产生有效括号
- 求GCD和LCM
- Web前端面试指导(二十一):如何向数组中间插入或删除元素?
- 观察者模式
- linux学习3
- HDU 2035 快速幂取模
- 屏幕适配的注意事项
- 机器学习练习(二)——多元线性回归
- 8086乘除指令详解(二)
- js中的undefined,null,空字符串,false,true之间的关系
- 再次认识Hibernate(二)
- 【42.38%】【BZOJ 3196】二逼平衡树
- 玩无限消乐的设计示例(高级篇)直线特效算法
- 小话设计模式(十六)中介者模式