1845专题

poj-1845 Sumdiv nyoj - 928 小M的因子和

题意:求解A^B的因子和 mod 9901 先求解素因子,然后二分求解等比数列 #include<cstdio>#include<cmath>typedef long long LL;const LL mod = 9901 ;LL pow(LL a,LL b){LL res=1;while(b){if(b&1) res=(res*a)%mod;a=(a*a)%mod;b>>=1;

JZOJ 1845——约数

先将1~n所有非素数除1外的最小公因数求出来 最后循环求出加上每一个i的除1外的最小公约数,如果为0,则加本身 代码如下: varn,i,j:longint;ans:int64;w:array[2..10000000] of longint;beginreadln(n);for i:=2 to trunc(sqrt(n)) doif w[i]=0 then for j:=1 to