比赛时候面向过题队伍数目 打表- -

看了题解发现确实是这么回事,分析能力太差..

/*
HDU 6063 - RXD and math [ 数学,规律 ] | 2017 Multi-University Training Contest 3
题意:
求 Σ μ(i)^2 * sqrt( n^k/i ) [ 1 <= i<= n^k ]
n,k <= 1e18
分析:
首先 μ(i) 为莫比乌斯函数,若 i 是完全平方数的倍数则 μ(i) = 0 ,否则 μ(i) = ±1
所以只有不是完全平方数的倍数的数才会对答案产生贡献
然后任何数都能表示为 x = a^2*b,即仅为一个非完全平方数的b的平方倍数
n^k/i 代表 n^k 中 i 的倍数的个数
则 sqrt(n^k/i) 代表 i 的 平方倍数 的个数
联系前面的 x = a^2*b ,可推得相当于每个数都只算了一次
故答案为 n^k
*/
#include <bits/stdc++.h>
using namespace std;
#define LL long long
const LL MOD = 1e9+7;
LL PowMod(LL a, LL m)
{
a %= MOD;
LL ret = 1;
while (m)
{
if (m&1) ret = ret*a%MOD;
a = a*a % MOD;
m >>= 1;
}
return ret%MOD;
}
int main()
{
LL n, k;
int tt = 0;
while (~scanf("%lld%lld", &n, &k))
{
printf("Case #%d: %lld\n", ++tt, PowMod(n, k));
}
}

HDU 6063 - RXD and math | 2017 Multi-University Training Contest 3的更多相关文章

  1. hdu 6063 RXD and math(快速幂)

    RXD and math Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)To ...

  2. 2017 ACM暑期多校联合训练 - Team 3 1008 HDU 6063 RXD and math (莫比乌斯函数)

    题目链接 Problem Description RXD is a good mathematician. One day he wants to calculate: ∑i=1nkμ2(i)×⌊nk ...

  3. HDU - 6063 RXD and math

    Bryce1010模板 http://acm.hdu.edu.cn/showproblem.php?pid=6063 打表发现规律是n^k #include <iostream> #inc ...

  4. 数学--数论--HDU 6063 RXD and math (跟莫比乌斯没有半毛钱关系的打表)

    RXD is a good mathematician. One day he wants to calculate: output the answer module 109+7. p1,p2,p3 ...

  5. HDU 6061 - RXD and functions | 2017 Multi-University Training Contest 3

    每次NTT都忘记初始化,真的是写一个小时,Debug两个小时- - /* HDU 6061 - RXD and functions [ NTT ] | 2017 Multi-University Tr ...

  6. HDU 6060 - RXD and dividing | 2017 Multi-University Training Contest 3

    /* HDU 6060 - RXD and dividing [ 分析,图论 ] | 2017 Multi-University Training Contest 3 题意: 给一个 n 个节点的树, ...

  7. HDU 6162 - Ch’s gift | 2017 ZJUT Multi-University Training 9

    /* HDU 6162 - Ch’s gift [ LCA,线段树 ] | 2017 ZJUT Multi-University Training 9 题意: N节点的树,Q组询问 每次询问s,t两节 ...

  8. 2017 Wuhan University Programming Contest (Online Round) Lost in WHU 矩阵快速幂 一个无向图,求从1出发到达n最多经过T条边的方法数,边可以重复经过,到达n之后不可以再离开。

    /** 题目:Lost in WHU 链接:https://oj.ejq.me/problem/26 题意:一个无向图,求从1出发到达n最多经过T条边的方法数,边可以重复经过,到达n之后不可以再离开. ...

  9. 2017 Wuhan University Programming Contest (Online Round) C. Divide by Six 分析+模拟

    /** 题目:C. Divide by Six 链接:https://oj.ejq.me/problem/24 题意:给定一个数,这个数位数达到1e5,可能存在前导0.问为了使这个数是6的倍数,且没有 ...

随机推荐

  1. go 二进制数据处理

    以下是利用标准库binary来进行编解码 编码 ①使用bytes.Buffer来存储编码生成的串②使用binary.Write来编码存储在①的buf中 package main import ( &q ...

  2. java中JDBC是什么?

    [学习笔记] JDBC是什么? JDBC即(java database connectivity数据连接).JDBC是Sun公司编的一堆类和方法,都封装在java.sql包中.你可以利用这堆类和方法来 ...

  3. Linux下安装jdk中遇到的坑

    比如:我以jdk-8u211-linux-i586.tar.gz为例进行. 下载完成后解压到指定文件下先创建java文件目录,如果已存在就不用创建[root@lyh:] # mkdir -p /usr ...

  4. 洛谷P2659 美丽的序列 单调栈模板

    P2659 美丽的序列 题目链接 https://www.luogu.org/problemnew/show/P2659 题目描述 为了研究这个序列的美丽程度,GD定义了一个序列的"美丽度& ...

  5. lg 1478

    好多天没碰代码了,感觉忘得差不多了,没有学习感觉罪恶深重,从今天起开始补题啊啊! 简单零一背包,套模板就行. #include<bits/stdc++.h> using namespace ...

  6. 数据分析—win7+ipython+notebook安装

    先安装python 3.x 然后 cmd 执行 pip3 ipython 然后 cmd 执行 pip3 install jupyter notebook 然后 cmd 执行 jupyter noteb ...

  7. 社工工具包 SEToolkit

    社会工程学(Social Engineering)简称社工,其通过分析攻击对象的心理弱点,利用人性的本能反应,以及任何好奇心,贪婪等心理特征进行的,使用诸如假冒,欺骗,引诱等多种手段来达成攻击目标的一 ...

  8. StoneTab标签页CAD插件 3.2.0

    //////////////////////////////////////////////////////////////////////////////////////////////////// ...

  9. js Indexof的用法

    JavaScript中indexOf()函数 JavaScript中indexOf()函数方法返回一个整数值,指出  String 对象内子字符串的开始位置.如果没有找到子字符串,则返回 -1.如果 ...

  10. vue打包后找不到资源路径问题

    问题描述: 使用webpack打包vue项目后,前后端联调无法找到资源 解决方案: 一. 改为相对路径,去除axios中地址的第一个“/” onProxyReq: function (proxyReq ...