hdu 3208 Integer’s Power 筛法】的更多相关文章

Integer’s Power Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Problem Description LMY and YY are number theory lovers. They like to find and solve some interesting number theory problems together. One day, they b…
Integer’s Power Time Limit: 1000ms Memory Limit: 32768KB This problem will be judged on HDU. Original ID: 320864-bit integer IO format: %I64d      Java class name: Main   LMY and YY are number theory lovers. They like to find and solve some interesti…
1. 题目描述定义如下函数$f(x)$:对于任意整数$y$,找到满足$x^k = y$同时$x$最小并的$k$值.所求为区间$[a, b]$的数代入$f$的累加和,即\[\sum_{x=a}^{b} f(x)\]2. 基本思路因为数据很大, 因此不适合暴力枚举.但是对于给定的数$y$,我们可以求得$x^k \le y$.假设$x^k$均不相同,那么直接可解.因为存在$2^4 = 4^2$的情况,因此,这里其实是个容斥.即$c[i]$的数值应该减掉$c[k \cdot i]$的数值.由于数据一定不…
找出(l,r)内的所有的指数最大的次方和 因为一个数可能可以看成a^b和c^d,所以我需要去重,从后往前枚举幂数,然后找可以整除的部分,把低次幂的数去掉. 然后开n方的部分,先用pow()函数找到最接近答案的数,但是会丢失精度,然后在这个数的附近寻找最接近答案的整数,用快速幂在乘n次幂回去,看最接近原本数的是哪一个. #include<map> #include<set> #include<ctime> #include<cmath> #include<…
题意 求[l,r]的最大指数和(1<=l,r<=10^18) 最大指数和(如64=8^2=4^3=2^6,所以64的最大指数和是6) 题解 很明显我们可以先求出[1,n]的最大指数和,然后再作差. 我们可以先求出num[i]代表[1,n]中最大指数为i的数有多少个. 然后枚举全部的i,然后让答案加上i*num[i]: 那么怎么求num[i]呢 我们可以求出[1,n]中指数为x的数有多少个作为num[x]的初步值.这个用n1/x就可以求出(不过要注意精度问题,及其恶心,看代码吧) 然后这个num…
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=1047 Integer Inquiry Description One of the first users of BIT's new supercomputer was Chip Diller. He extended his exploration of powers of 3 to go from 0 to 333 and he explored taking various sums of t…
B - Balala Power! 题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=6034 题面描述 Talented Mr.Tang has n strings consisting of only lower case characters. He wants to charge them with Balala Power (he could change each character ranged from a to z into each…
http://acm.hdu.edu.cn/showproblem.php?pid=4461 题意:每个棋子有一个权值,给出红方的棋子情况,黑方的棋子情况,问谁能赢. 思路:注意“ if a player has no Ma or no Pao, or has neither, his total offense power will be decreased by one”这句话即可. #include <cstdio> #include <cstring> #include &…
Integer Inquiry Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 11678    Accepted Submission(s): 2936 Problem Description One of the first users of BIT's new supercomputer was Chip Diller. He ex…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4658 题意:给出n.k.求n的拆分方案数.要求拆分中每个数不超过k. i64 f[N]; void init(){    f[0]=f[1]=1; f[2]=2;    int i,j,k,t;    for(i=3;i<N;i++) for(j=1;;j++)    {        FOR0(k,2)        {            if(!k) t=(3*j*j-j)/2;     …