码迷,mamicode.com
首页 >  
搜索关键字:prime    ( 2475个结果
模板:素数筛
1 //埃氏筛法 2 int prime[N]; 3 bool is_prime[N+1]; 4 5 //返回n以内素数的个数 6 int sieve(int n){ 7 int p=0; 8 for(int i=0;i<=n;i++) is_prime[i]=1; 9 is_prime[0]=is... ...
分类:其他好文   时间:2017-10-14 17:00:15    阅读次数:136
洛谷 P3663 [USACO17FEB]Why Did the Cow Cross the Road III S
P3663 [USACO17FEB]Why Did the Cow Cross the Road III S P3663 [USACO17FEB]Why Did the Cow Cross the Road III S P3663 [USACO17FEB]Why Did the Cow Cross ...
分类:其他好文   时间:2017-10-13 20:21:37    阅读次数:208
B1013 数素数
#include using namespace std; const int MAXN = 1000000; int prime[MAXN]; int num = 0; bool p[MAXN] = { 0 }; void find_prime(int n) { for (int i = 2; i... ...
分类:其他好文   时间:2017-10-10 21:46:42    阅读次数:122
POJ1751 Highways【最小生成树】
题意: 给你N个城市的坐标,城市之间存在公路,但是由于其中一些道路损坏了,需要维修,维修的费用与公路长成正比(公路是直的)。 但现有M条公路是完整的,不需要维修,下面有M行,表示不需要维修的道路两端的城市,问最短费用。 思路: lowcost[i]数组存还未处理的城市i离已经处理过的城市的最短距离, ...
分类:其他好文   时间:2017-10-10 20:38:17    阅读次数:167
朝花夕拾之Struts2的StrutsPrepareAndExecuteFilter的过滤执行
先来看下StrutsPrepareAndExecuteFilter的doFilter方法: 下面对doFilter方法中的重点部分一一讲解: (1)prepare.setEncodingAndLocale(request, response); (2)prepare.createActionCont ...
分类:其他好文   时间:2017-10-10 16:37:47    阅读次数:200
【学习笔记】卢卡斯定理
洛谷 P3807 【模板】卢卡斯定理 题目背景 这是一道模板题。 题目描述 给定n,m,p(1\le n,m,p\le 10^51≤n,m,p≤10?5??) 求 C_{n+m}^{m}\ mod\ pC?n+m?m?? mod p 保证P为prime C表示组合数。 一个测试点内包含多组数据。 输 ...
分类:其他好文   时间:2017-10-10 09:57:44    阅读次数:248
POJ3126:Prime Path
POJ3126:Prime Path kuangbin专题一:F题 Description The ministers of the cabinet were quite upset by the message from the Chief of Security stating that the ...
分类:其他好文   时间:2017-10-08 21:22:46    阅读次数:288
POJ2421 Constructing Roads【最小生成树】
题意:有N个点,有些点已经连接了,然后求出所有点的连接的最短路径是多少。 思路:最小生成树的变形,有的点已经连接了,就直接把他们的权值赋为0,一样的就做最小生成树。 代码: prime: 1 #include <cstdio> 2 #include <iostream> 3 4 using name ...
分类:其他好文   时间:2017-10-08 16:07:29    阅读次数:124
数论板子——来自Loi_black
#include #include #include #include using namespace std; const int maxn=200005; int prime[maxn]; bool not_prime[maxn]; int main() { int n,cnt=0; scanf... ...
分类:其他好文   时间:2017-10-08 11:14:19    阅读次数:198
[Luogu 3807]【模板】卢卡斯定理
Description 给定n,m,p(1≤n,m,p≤10?^5??) 求 C_{n+m}^{m} \mod p 保证P为prime C表示组合数。 一个测试点内包含多组数据。 给定n,m,p(1≤n,m,p≤10?^5??) 求 C_{n+m}^{m} \mod p 保证P为prime C表示组 ...
分类:其他好文   时间:2017-10-07 22:04:28    阅读次数:165
2475条   上一页 1 ... 80 81 82 83 84 ... 248 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!