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 ...
随机推荐
- vue v-for 渲染完成回调
vue开发中等待vue渲染完成后加载数据的回调方法 Vue.nextTick(function () { alert("加载完成!"); }) 特别注意,如果使用ajax异步渲染的 ...
- 设置utf8编码问题
注意:乱码和request的具体实现类有关,现在已经查到的是RequestDispatcher.forward调用前使用的是org.apache.catalina.connector.RequestF ...
- wifi共享精灵2014.04.25.001已经更新,wifi热点中文名走起!
五一回来后,有个惊喜,wifi共享精灵有了最新动向.不晓得wifi共享精灵是啥的朋友,我来解释下,它就相当于一个无线路由器.说起来,Wifi共享精灵正式版2014.04.25.001(http://w ...
- UVa 170 - Clock Patience
题目:Clock Patience游戏,将52张扑克牌,按时钟依次分成13组(中心一组),每组4张全都背面向上, 从中间组最上面一张牌開始.翻过来设为当前值,然后取当前值相应组中最上面的背过去的牌翻过 ...
- [Oracle] - Connect to a PDB of Oracle12c
Story about CDB and PDB Oracle12c has a new feature and definition of CDB and PDB. If you first use ...
- ShareREC for iOS v1.0.4 已经公布
ShareREC for iOS v1.0.4 已经公布 版本号:v1.0.4 2015-3-13 1.新增视频列表的筛选排序功能 2.修复在開始录制后,没有调用结束录制直接进入社区崩溃问题 3.优化 ...
- c3---scanf
#include <stdio.h> int main(int argc, const char * argv[]) { // 要求: 存储用户输入的整数 // 1.用户输入的整数确定吗? ...
- [jzoj 6101] [GDOI2019模拟2019.4.2] Path 解题报告 (期望)
题目链接: https://jzoj.net/senior/#main/show/6101 题目: 题解: 设$f_i$表示从节点$i$到节点$n$的期望时间,$f_n=0$ 最优策略就是如果从$i, ...
- 1.Win32基本程序概念
还没学会走之前,不要跑! Message based , event driven 每个程序都应该有一个如下的循环:MSG msg;while(GetMessage(&msg,NULL,NUL ...
- js中,实现对键盘按键的监听:
<script> function keyUp(e) { var currKey=0,e=e||event; currKey=e.keyCode||e.which||e.charCode; ...