HDU 2421
由算术基本定理N=p1^e1*p2^e2....ps^es,可知一个素的因子个数为(e1+1)*(e2+1)*...*(es+1)。
而N的一人因子必定也有n=p1^k1*p2^k2。。。。*ps^ks的形式。因子个数形式同上。
而事实上,即是从ei中选取其中一些来充当k1。那么,所有的因子的个数之和必定是(1+2+...e1+1)*(1+2....e2+1)*...其实即是拆开相乘,相当于有各种组合。而
立方是积性的,所以先把(1^3+2^3+....(e1+1)^3)*(1^3+......)*.......
有公式
1^3+2^3+3^3+...+n^3=(1+2+3+...+n)^2
题目可解。
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#define LL __int64
using namespace std;
int pe[1000],np;
const LL MOD=10007;
int main(){
int a,b;
int kase=0;
while(scanf("%d%d",&a,&b)!=EOF){
np=0;
for(int i=2;i*i<=a;i++){
if(a%i==0){
int c=0;
while(a%i==0){
c++;
a/=i;
}
pe[np++]=c*b;
}
}
if(a>1){
pe[np++]=1*b;
}
LL ans=1;
for(int i=0;i<np;i++){
LL tmp=((((LL)2+(LL)pe[i]))*((LL)pe[i]+(LL)1)/2)%MOD;
ans=(ans*((tmp*tmp)%MOD))%MOD;
}
printf("Case %d: %I64d\n",++kase,ans);
}
return 0;
}
HDU 2421的更多相关文章
- hdu 2421 Deciphering Password(约数个数问题)
http://acm.hdu.edu.cn/showproblem.php?pid=2421 A^B 能够写成 p1^e1 * p2^e2 * .....*pk^ek.(A.B <= 10000 ...
- poj 1251 poj 1258 hdu 1863 poj 1287 poj 2421 hdu 1233 最小生成树模板题
poj 1251 && hdu 1301 Sample Input 9 //n 结点数A 2 B 12 I 25B 3 C 10 H 40 I 8C 2 D 18 G 55D 1 E ...
- HDU——PKU题目分类
HDU 模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 ...
- HDU 5643 King's Game 打表
King's Game 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5643 Description In order to remember hi ...
- HDOJ 2111. Saving HDU 贪心 结构体排序
Saving HDU Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
- 【HDU 3037】Saving Beans Lucas定理模板
http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...
- hdu 4859 海岸线 Bestcoder Round 1
http://acm.hdu.edu.cn/showproblem.php?pid=4859 题目大意: 在一个矩形周围都是海,这个矩形中有陆地,深海和浅海.浅海是可以填成陆地的. 求最多有多少条方格 ...
- HDU 4569 Special equations(取模)
Special equations Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u S ...
- HDU 4006The kth great number(K大数 +小顶堆)
The kth great number Time Limit:1000MS Memory Limit:65768KB 64bit IO Format:%I64d & %I64 ...
随机推荐
- 使用UE4公布安卓平台游戏
使用了几天的UE4 ,总算是将游戏在安卓平台执行起来了.当中遇到非常多问题,而且终于依旧有一些问题没能解决. 整体感觉是UE4这款引擎眼下还不够成熟.问题较多. 没有unity使用起来方便. 可是既然 ...
- String与StringBuffer的差别
String 是一个常量,即一旦创建不可更改 输出结果为:helloworldjeok 看似.string变量name的值改变了,事实上此name非彼name. 输出结果为: sex:hello wo ...
- 【DataStructure】The difference among methods addAll(),retainAll() and removeAll()
In the Java collection framework, there are three similar methods, addAll(),retainAll() and removeAl ...
- FastDFS分布式文件系统研究
FastDFS分布式文件系统 这个主要是针对应用型的,很使用,特别是对于电商等 一.编译安装 ubuntu平台: apt-get install libevent(这个默认就有,没有就装下) libe ...
- [MySQL] 查询一段时间记录
24小时内记录(即86400秒) $sql="SELECT video_id,count(id)as n FROM `rec_down` WHERE UNIX_TIMESTAMP(NOW() ...
- 41.使用SAX读取XML
main.cpp #include <QtGui> #include <iostream> #include "saxhandler.h" int main ...
- 像素点的Hessian矩阵
最近开始学习图像处理相关知识,碰到对像素点求黑塞矩阵查了资料才搞懂. 给定一个图像f(x,y)上的一点(x,y).其黑塞矩阵如下: 因为导数的公式是f'(x)=(f(x+dx)-f(x))/dx在数字 ...
- win10下CorelDRAW菜单栏字体变成白色了怎么办?
相信很多同学安装了win10系统之后,你的 CDR 菜单栏就变了,变得没有任何内容,以白色显示,win10系统与CorelDRAW早期的版本兼容方面存在问题,(CorelDRAW x7/X8无此问题出 ...
- rem 自适应布局 bootstrap 移动端适配
移动端适配用:rem 自使用布局用:bootstrap
- Dobble的学习视频地址
http://www.tebaidu.com/file-f698fb45eb1b5c59571936118968d86c89194311.html