码迷,mamicode.com
首页 >  
搜索关键字:bear and prime numbe    ( 2904个结果
Semi-prime H-numbers POJ 3292(素数筛)
原题 题目链接 题目分析 由题意可知,我们要做的第一步就是把H-prime筛出来,仔细观察可以发现,如果i是H-prime,则i*i+4*k*i(k=0,1,2,3...)也是H-prime,这里为了方便筛可以把原数x表示为x/4.筛出H-prime后就暴力处理出H-composites(记得去重) ...
分类:其他好文   时间:2019-09-02 10:07:06    阅读次数:95
[欧拉降幂][2019南京网络赛B]super_log
题意:输入a,b,p,求(底数a的右上角有b-1个a) 思路: 广义欧拉定理: AC代码: #include<bits/stdc++.h> typedef long long ll; using namespace std; ll a,b,m; ll vis[1000005]; ll prime[1 ...
分类:其他好文   时间:2019-09-01 23:57:42    阅读次数:269
Leetcode Weekly Contest 152
退役老人现在连leetcode都不会做了 = = 今天早上做了leetcode第三题题目看错了,加上比赛中间还在调投稿的实验,一心二用直接gg 总结下教训就是 本渣现在做题连题目都看不清就开始做。开始写题之前应当把样例过一遍,然后自己再造1 2个例子,然后再开始做 A题:统计素数的个数(素数筛或者s ...
分类:其他好文   时间:2019-09-01 16:20:21    阅读次数:78
Leetcode-5173 Prime Arrangements(质数排列)
1 #define _for(i,a,b) for(int i = (a);i < b;i ++) 2 #define _rep(i,a,b) for(int i = (a);i > b;i --) 3 4 class Solution 5 { 6 public: 7 bool is_prime(i... ...
分类:其他好文   时间:2019-09-01 14:23:44    阅读次数:84
[CF643E]Bear and Destroying Subtrees(期望,忽略误差)
Description: ? 给你一棵初始只有根为1的树 ? 两种操作 ? 表示加入一个新点以 为父亲 ? 表示以 为根的子树期望最深深度 ? 每条边都有 $\frac{1}{2}$ 的概率断裂。 Solution: $$ E(\max\{A\}) \not=\max\{E(A)\} $$ ? 所以 ...
分类:其他好文   时间:2019-08-31 19:06:17    阅读次数:56
echarts 属性的设置(完整大全一)工具箱 被坑5币
toolbox: { orient: 'horizontal', // 布局方式,默认为水平布局,可选为:'horizontal' | 'vertical' x: 'right', // 水平安放位置,默认为全图右对齐,可选为:'center' | 'left' | 'right' | {numbe... ...
分类:其他好文   时间:2019-08-29 09:30:57    阅读次数:103
UVA 10789 题解
Prime Frequency Given a string containing only alpha-numerals (0-9,A-Z and a-z) you have to count the frequency (thenumber of times the character is p ...
分类:其他好文   时间:2019-08-29 09:25:09    阅读次数:77
UVA 10395 素数筛
Twin Primes Twin primes are pairs of primes of the form (p; p + 2). The term \twin prime" was coined by PaulStckel (1892-1919). The rst few twin prime ...
分类:其他好文   时间:2019-08-29 09:21:43    阅读次数:65
HGOI 20190828 题解
Problem A 数学题 设数论函数$f(x)$表示$x(x ? Prime)$的次大因数, 给出$l,r$求出$\sum\limits_{i=l,i ? Prime} ^r f(i)$ 。 对于$100\%$的数据,$1 \leq l\leq r\leq 5\times 10^9$ Soluti ...
分类:其他好文   时间:2019-08-29 00:05:51    阅读次数:86
线性筛
const int N=100000+5; bool prime[N];//prime[i]表示i是不是质数 int p[N],tot;//p[N]用来存质数 void init() { //初始化为质数 for(int i=2;i<N;i++) prime[i]=true; for(int i=2... ...
分类:其他好文   时间:2019-08-28 10:51:02    阅读次数:64
2904条   上一页 1 ... 26 27 28 29 30 ... 291 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!