Fork me on GitHub

02 2017 档案

摘要:luoguvijos两种方法一、带权并查集:问题 front做差#include#include #include#include#include#include#include#includeusing namespace std;int f[50001],front[50000... 阅读全文
posted @ 2017-02-26 11:26 primes 阅读(350) 评论(0) 推荐(0)
摘要:设置两个数组来记录后面的长度和前面的长度#include#include #include#include#include#include#include#includeusing namespace std;int behind[30010],front[30010],f[300... 阅读全文
posted @ 2017-02-24 13:33 primes 阅读(169) 评论(0) 推荐(0)
摘要:朴素并查集#include#include#include#include#include#include#includeusing namespace std;int n,m;vector dr[1001];int py[1001];int findpy(int x){ ... 阅读全文
posted @ 2017-02-22 15:51 primes 阅读(233) 评论(0) 推荐(0)
摘要:题见洛谷最小生成树prim 并点#include#include#include#include #includeusing namespace std;int tu[101][101],dis[101],a[101];int main(){ //freopen("a.i... 阅读全文
posted @ 2017-02-10 11:37 primes 阅读(170) 评论(0) 推荐(0)
摘要:Page 527 出现的 大 错误:ans[ ] 内的数不是一个一个挨着放进去的 !而是按照扫到的范围的顺序放进去 #include<iostream> #include<cstdio> #include<cstring> #include<string> #include<algorithm> u 阅读全文
posted @ 2017-02-10 08:21 primes 阅读(465) 评论(0) 推荐(0)
摘要:#include#include#include#include #includeint n,m;int f[10001];int tree[10001][301];int r[10001],ans=0;using namespace std;int main(){ scan... 阅读全文
posted @ 2017-02-09 16:07 primes 阅读(194) 评论(0) 推荐(0)
摘要:题见洛谷#include#include#include#include #includeusing namespace std;int deep,n,maxl=0,anst=999999;struct H{ int tim,tall,last;}st[200];int f[... 阅读全文
posted @ 2017-02-09 09:46 primes 阅读(133) 评论(0) 推荐(0)
摘要:题见洛谷#include#include#include#include #includeusing namespace std;long long ans=0;int a[300],n,f[300][300];int main(){ scanf("%d",&n); f... 阅读全文
posted @ 2017-02-08 16:35 primes 阅读(86) 评论(0) 推荐(0)
摘要:题见洛谷由于依赖少 , 可以改为分组背包 #include#include#include#include #includeusing namespace std;int v[210],c[210],n,m,wj[210][3],wpv[210],wpc[210]; int f[... 阅读全文
posted @ 2017-02-08 15:03 primes 阅读(130) 评论(0) 推荐(0)
摘要:题见洛谷记忆化搜索#include#include#include#include #includeusing namespace std;int num[5],a0[400];int dp[40][40][40][40],ans=0;int n,m;int dfs(int x,i... 阅读全文
posted @ 2017-02-08 09:44 primes 阅读(176) 评论(0) 推荐(0)
摘要:题见洛谷#include#include#include#include#include#include#define LL long longusing namespace std;bool lief[10][10],hangf[10][10],gef[10][10];int a... 阅读全文
posted @ 2017-02-07 16:39 primes 阅读(225) 评论(0) 推荐(0)
摘要:题见洛谷位运算版(设计巧妙,需要回顾,加深理解)#include#include#include#include#include#include#includeusing namespace std;int a[20];int ans=0,uplimit,n;void print(... 阅读全文
posted @ 2017-02-07 15:06 primes 阅读(212) 评论(0) 推荐(0)
摘要:#include#include#include#include#include#includeusing namespace std;int ans[200][200];int tall[200][200];int dx[]={0,1,-1,0,0};int dy[]={0,0,... 阅读全文
posted @ 2017-02-07 11:20 primes 阅读(143) 评论(0) 推荐(0)
摘要:题见洛谷 带有技巧的搜索,用到杨辉三角形 不难看出 第几个(k)拆的数(虽说并不是拆的),系数为杨辉三角第n行,第k列的数字#include#include#include#include#include#includeusing namespace std;int n,sum... 阅读全文
posted @ 2017-02-07 09:18 primes 阅读(239) 评论(0) 推荐(0)
摘要:题见洛谷#include#include#include#include#include#include#includeusing namespace std;int a[40][40],n;bool f[40][40];int dx[]={0,1,-1,0,0};int dy[]... 阅读全文
posted @ 2017-02-06 17:13 primes 阅读(162) 评论(0) 推荐(0)
摘要:题见洛谷#include#include#include#include#include#include#includebool f[1005][1005];char a[1005][1005];int dx[]={0,0,0,1,-1};int dy[]={0,1,-1,0,0}... 阅读全文
posted @ 2017-02-06 17:08 primes 阅读(170) 评论(0) 推荐(0)
摘要:题见洛谷#include#include#include#include#include#include#include#define LL long long#define p 0.00000001using namespace std;int n,k;int pos[10000... 阅读全文
posted @ 2017-02-06 11:43 primes 阅读(179) 评论(0) 推荐(0)
摘要:总时间限制: 3000ms 内存限制: 65536kB 【】描述 给出4个小于10个正整数,你可以使用加减乘除4种运算以及括号把这4个数连接起来得到一个表达式。现在的问题是,是否存在一种方式使得得到的表达式的结果等于24。这里加减乘除以及括号的运算结果和运算的优先级跟我们平常的定义... 阅读全文
posted @ 2017-02-06 09:42 primes 阅读(224) 评论(0) 推荐(0)
摘要:题目#include#include#include#include#include#include#define LL long longusing namespace std;int lief[10][10],hangf[10][10],gef[10][10];int quan... 阅读全文
posted @ 2017-02-05 16:52 primes 阅读(119) 评论(0) 推荐(0)
摘要:高精加 压位#include#include#include#include#include#include#define LL long longusing namespace std;int a[1000],b[1000],c[1000];char s1[1001],s2[10... 阅读全文
posted @ 2017-02-05 10:02 primes 阅读(110) 评论(0) 推荐(0)
摘要:1.枚举 2.前缀和维护 差值维护(详见上一篇) 3.最大字段和for (i=1; ip) t--; ans=max(ans,a[i]+b[t]); }6.折半搜索 (这个我也不会)直接贴标程、、、、折半搜索+two point体积之和m) t--; if (t) ... 阅读全文
posted @ 2017-02-04 10:03 primes 阅读(133) 评论(0) 推荐(0)
摘要:比线段树慢但是简洁一维差值维护对a数组进行m次操作,每次在l~r上加不同的值,最后输出ql~qr的区间和cha[i]=a[i]-a[i-1];//差值cha[l]+=k,cha[r+1]-=k;//差值维护//那么m次操作后a[i]=∑cha[1~i];s[i]=∑a[1~i];a... 阅读全文
posted @ 2017-02-04 09:30 primes 阅读(101) 评论(0) 推荐(0)