2012年3月9日

poj 1995 Raising Modulo Numbers

摘要: //题意:计算(A1^B1+A2^B2+ ... +AH^BH)mod M.#include <iostream> //快速幂取模#include <stdio.h>using namespace std;int power(int a,int b,int m) //快速幂取模计算 (a^b)%m{ if(a==0) return 0; else if(b==0) return 1; int r=a%m,k=1; //中间运算过程(k*r,r*r)不会超int范围,m<=45000,m*m<INT_MAX while... 阅读全文

posted @ 2012-03-09 11:31 sysu_mjc 阅读(139) 评论(0) 推荐(0) 编辑

导航