[CF542D]Superhero's Job】的更多相关文章

[CF542D]Superhero's Job 题目大意: 定义函数 \[ J(x) = \sum_{\substack{1 \leq k \leq x \\ k \mid x \\ \gcd \left( k, x / k \right) = 1}} k \] 给定\(n(n\le10^{12})\),求方程\(J(x)=n\)的解的个数. 思路: 对于\(\gcd(a,b)=1\),\(J(ab)=J(a)J(b)\). 对于\(p\in\mathbb{P}\),\(J(p^k)=p^k+1…
[CF542D]Superhero's Job 题意:$ f(x)=\sum\limits_{d|x,gcd(d,{x\over d})=1} d$ 给出 $A$ ,求方程 $f(x)=A$ 的正整数解的个数. $1\le A\le 10^{12}$ 题解:首先我们发现f这个函数是积性的,$f(p^a)=1+p^a$(p是质数).所以我们枚举$A$的所有约数,看一下他能不能拆成$1+p^a$的形式,并把p相同的放到一起.设f[i]表示乘积为i的方案数,暴力DP即可.你甚至可以用map. 附:$1…
E. Superhero Battle time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A superhero fights with a monster. The battle consists of rounds, each of which lasts exactly nn minutes. After a round…
原文链接https://www.cnblogs.com/zhouzhendong/p/CF542D.html 题目传送门 - CF542D 题目传送门 - 51Nod1477 题意 定义公式 $J(x) = \sum_{1 \leq k \leq x 且 k|x 且 \gcd (k,x/k) = 1} k$ . 现在给定一个整数 $A$ ,要求有多少正整数 $x$ ,满足 $J(x)=A$ . $x|n$ 表示 $x$ 是 $n$ 的因子. $\gcd(a,b) 表示 $a$ 和 $b$ 的最大…
E. Superhero Battle A superhero fights with a monster. The battle consists of rounds, each of which lasts exactly …
A superhero fights with a monster. The battle consists of rounds, each of which lasts exactly n minutes. After a round ends, the next round starts immediately. This is repeated over and over again. Each round has the same scenario. It is described by…
首先,对于这题我们要知道要删除一个数使平均值最大一定是删除最小的数,然后我们假设删除操作执行了i次,也就是删除最小的i个数.在已知删除操作次数之后求增加操作的次数就容易了,当然是m - i和k * (n - i)中比较小的数啦.用一个ans变量记录结果,遍历i,更新ans,得到最终的ans. B - Average Superhero Gang Power GNU C++11 Accepted 46 ms 400 KB #include "bits/stdc++.h" using na…
A superhero fights with a monster. The battle consists of rounds, each of which lasts exactly nn minutes. After a round ends, the next round starts immediately. This is repeated over and over again. Each round has the same scenario. It is described b…
链接 [https://codeforces.com/contest/1141/problem/E] 题意 怪物开始的生命值,然后第i分钟生命值的变化 问什么时候怪物生命值为非正 分析 有一个巨大的坑 其实是很简单的一个题 可我还是跳了进去很多次 对于超过n的特别注意就行了 算是经典贪心吧 看代码吧 代码 #include<bits/stdc++.h> using namespace std; #define ll long long const int N=2e5+10; ll d[N];…
\[x*p\ge y\rightarrow x=\lfloor{{y-1}\over p}\rfloor+1\]…