![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
信息学
文章平均质量分 57
little_csd
........
展开
-
最小生成树
贪心#include#includeusing namespace std;struct hh{ int a, b; long long c;}tree[111111];int n, m, fa[111111];long long ans=0;int cmp(hh x, hh y){ return x.c<y.c;}int find(int x){ if(x!=f原创 2016-07-02 18:23:13 · 192 阅读 · 0 评论 -
线段树练习4
#include#includeusing namespace std;struct h{ int l, r, x[8], val;}tree[270000];int a, b, m;char c[22];void built(int d, int l, int r){ tree[d].l=l; tree[d].r=r; tree[d].val=0; for(int i=原创 2016-07-02 18:13:23 · 152 阅读 · 0 评论 -
codevs_4927 线段树练习5
#include#include#include#define ll long longusing namespace std;struct h{ int l, r; ll v, vset, vadd, maxn, minn;}tree[270000];int n, q, a, b, pd[270000];ll x;char s[10];void weihu(int d)原创 2016-07-05 13:55:56 · 317 阅读 · 0 评论 -
codevs_5037 线段树练习4加强版
#include#include#define mod 800using namespace std;int n, m, k, l, r, x;char s[10];int a[200050], v[251][200050], seg[251];void read(int &xx){ char tt=getchar();int sx=1; while((tt'9')&&tt!=原创 2016-07-05 20:23:35 · 636 阅读 · 1 评论 -
noip2011普及组第四题
要用栈写比较方便,速度也还挺快O(n),主要是每遇到一个非括号符号就插两个数进数字栈里,遇到符号就从优先级入手,比如匹配到加号然后栈里面有乘号就要先解决栈里面的乘号,直到遇到‘(’符号为止。有一个小技巧就是开头先再字符串后面加一个‘)’,再把左括号加入栈内。等下就不用去清栈,可以保证运行完后栈必空。#include#include#include#define mod 10007#原创 2016-08-12 14:06:29 · 646 阅读 · 0 评论 -
noip2015普及组第四题
不会写全动归,只能写半动归半暴搜。主要DFS枚举行数,dp目前矩阵,类似求最大和,预处理好每一列自身的值以及各行间的值就可以了。#include#include#include#include#define maxn 214748364using namespace std;int n, m, r, c, ans=maxn;int v[18], a[18][18], s1[18]原创 2016-08-13 14:22:32 · 282 阅读 · 0 评论 -
炮兵阵地
三维的dp[i][a][b],表示第i行,前一行状态为a,再前一行的状态为b,用二进制表是状态如10010表示第一和第四个位置有阵地,然后预处理出每一种状态的炮兵数量。每一行读取完后就预处理该行所有可能的状态, x&x 注意第一行和第二行先进行dp,再处理后面几行。#include#include#include#define N 10using namespace std;原创 2016-08-14 16:01:19 · 314 阅读 · 0 评论