- 博客(48)
- 资源 (1)
- 收藏
- 关注
原创 HDUOJ 2795 Billboard
很经典的线段树题目,只需要每次找尽量靠上并且能放下这块板的位置就行了。p.s:注意(1 n,h等于n就行了,因为最多只有n块板。#include#include#include#include#define For(x, y) for(int i=x; i<=y; i++)#define Lson l,mid,k<<1#define Rson mid+1,r,k<<1|1#d
2014-12-21 09:29:53
596
原创 POJ 2828 Buy Tickets
线段树题目;逆序建立线段树,因为最后放i位置的应该先占i这个位置;然后其他只需往后移就行了,为什么能用线段树了,因为题目满足Posi ∈ [0, i − 1] ,不然线段树是无法做的..谨记...#include#include#include#include#include#define For1(x, y) for(int i=x; i<=y; i++)#defin
2014-12-21 09:24:22
594
原创 POJ 3468 A Simple Problem with Integers
区间修改+区间查询#includeusing namespace std;const int M=100005;struct Seb_tree{int l;int r;long long col;long long sum;};Seb_tree t[M*4+1];void push_down(int k){if (t[k].col){
2014-12-14 17:51:24
487
原创 HDUOJ 1698 Just a Hook
区间修改+单点查询#include#include#includeusing namespace std;const int M=100005;struct Seb_tree{ int l; int r; int col;};Seb_tree t[M*4+1];int n, m, nn;void build(int l, int r, int k){ t[
2014-12-14 17:44:46
560
原创 HDUOJ 1754 I Hate It
维护区间最值#include#include#include#include#includeusing namespace std;const int M=200005;struct RMQ{ int l; int r; int maxx;};RMQ t[M*4+1];int s[M*2];int n,m;int res=0;void add(int x, i
2014-12-14 17:44:11
602
原创 HDUOJ 1166 敌兵布阵
单点更新+区间求和#include#include#includeusing namespace std;const long M=50005;struct Seb_tree{ long l; long r; long long sum;};Seb_tree t[M*4+1];long s[M];long long total=0;long n,m
2014-12-14 17:41:17
483
原创 CH Round #52 - Thinking Bear #1 (NOIP模拟赛) 拆地毯
题目的问题为:无向图n个点m条边中选k条边(不得有环),使得这k条边的权值最大;Part 1: 随随便便的贪心.....60+(后来看到题解发现,后面有一个点k=1,找最大值就行了...又没有认真地看题...TAT) #include#include#include#include#includeusing namespace std;const in
2014-11-30 11:18:21
540
原创 NOIP2014题解
Day 1 T1:完全模拟.... T2:枚举中点+完全平方优化; T3:完全背包的思想;Day 2 T1: 枚举... T2:反图bfs+正图spfa; T3:只会做暴力30分;//Day 1 T1;#include#include#include#
2014-11-27 13:45:39
705
原创 Code Vs 1003 电话连线
#include#include#include#include#include#include#include#includeusing namespace std;//------------------------------------------const int M=105;const int INF=0xfffffff;//----------------
2014-11-22 18:52:10
662
原创 Uvaoj 11292 - Dragon of Loowater
很水的贪心题...TAT...#include #include #include #include using namespace std;const int M=20005;int n,m;int main(){ while (scanf("%d %d", &n, &m) && n &&m) { int ans=0; int a[200005]; int b
2014-11-19 13:48:01
486
原创 Code Vs 1137 计算系数
/*二项式定理:c(n,k)*a^n-k*b^k; 杨辉三角:c(n,k)=c(n-1,k-1)+c(n-1,k-1); */#include#include#includeusing namespace std;const int mod=10007;int f[1010][1010];int a,b,k,n,m;int ans=0;void solve(){ in
2014-11-10 16:51:47
659
原创 Code Vs 1010 过河卒
/*很明显动态转移方程f[i][j]表示从(0,0)到(n,m)的方案数;f[i][j]=f[i-1][j]+f[i][j-1](先处理马的位置) f[0][0]=1; */#include#include#include#includeusing namespace std;const int M=105;int f[M][M];int map[M
2014-11-10 16:37:35
658
原创 ural 1018 二叉苹果树
/*二叉苹果树(树形dp)f[root, m]=f[root.left, i]+f[root.right, m-i-1]+v[root];*/#include#include#include#include#include#includeusing namespace std;const int M=105;struct linklist{ int s; int va
2014-11-05 14:00:01
708
原创 Code Vs 1048 石子归并
/*石子合并; 给出n颗石子,把相邻的石子合并在一起,最后变成一堆的最小费用。很明显,石子最后都会变成一堆,即区间[i,j]由[i,k] && [k+1.j]。区间大的由区间小的而来,所以区间长度为阶段,我们需要枚举起点和结束点。动态转移方程:令f[i][j]表示以i为起点,j为结束点的最小费用,得:f[i][j]=min(f[i][k]+f[k+1][j]+t[i][j], f[i][
2014-11-02 18:09:41
811
原创 CH Round #57 - Story of the OI Class 查错
很明显的topo排序,字典序输出+#include#include#include#include#include#include#include#includeusing namespace std;priority_queue, greater >s1;const int M=100005;struct linklist{ int x; linklist *ne
2014-11-02 09:53:37
565
原创 Code Vs 1169 传纸条 && 2008年NOIP全国联赛提高组
/*传纸条;找出两条加起来为最优的路径; 先考虑一条的情况,令f[i][j]表示以(i,j)为结束点得到的最大好感值;显然,f[i][j]=max(f[i-1][j],f[i][j-1])+c[i][j];能不能做两次dp得到两条路径就是答案呢?这是不能的,如果两条路径有交叉,那么第二条路径可以通过另外方向来找到最大;所以,令f[i1][j1][i2][j2]表示以第一条路
2014-10-31 22:16:06
747
原创 CodeVs 2054 货币系统
#include#include#include#include#includeusing namespace std;const int M=35;int s[M];int n, v;long long f[10005];void solve(){ memset(f, 0, sizeof(f)); f[0]=1; for (int i=1; i<=n; i++)
2014-10-30 13:17:45
496
原创 逃亡的准备(hallows)
#include#include#include#include#includeusing namespace std;struct bag{ int w; int p;};bag s[1000005];int f[8005];int n, v;int tot=0;void solve(){ f[0]=0; for (int i=1; i<=tot; i++)
2014-10-29 22:19:52
1074
原创 Code Vs 1155 金明的预算方案&& 2006年NOIP全国联赛提高组
金明的预算方案(budget.pas/c/cpp)【问题描述】金明今天很开心,家里购置的新房就要领钥匙了,新房里有一间金明自己专用的很宽敞的房间。更让他高兴的是,妈妈昨天对他说:“你的房间需要购买哪些物品,怎么布置,你说了算,只要不超过N元钱就行”。今天一早,金明就开始做预算了,他把想买的物品分为两类:主件与附件,附件是从属于某个主件的,下表就是一些主件与附件的例子:主
2014-10-28 21:15:12
707
原创 蛙人
蛙人(ple)【问题描述】蛙人使用特殊设备潜水。设备中有一个气瓶,分两格:一格装氧气,另一格装氮气。留在水中有时间的限制,在深水中需要大量的氧气与氮气。为完成任务,蛙人必须安排好气瓶。每个气瓶可以用它的重量和含有气体的体积来描述。蛙人要完成任务,就需要特定数量的氧气与氮气。要完成任务,他所需带的气瓶的总重量最少是多少呢?例如:蛙人有下述五个气瓶。每个气瓶表述为:氧气的体积,氮气的体积(
2014-10-28 16:49:18
1294
原创 关键子工程
/*关键子工程--关键路径*/#include#include#include#include#include#includeusing namespace std;const int M=305;int n;struct linklist{ int s; int val; linklist *next;};linklist map[M*2];linklist
2014-10-26 21:07:05
494
原创 关键路径
/*关键路径--图论最后一个,苦逼的图论复习就要结束了~~OTL... */#include#include#include#include#include#includeusing namespace std;const int M=10005;struct linklist{ int s; int w; linklist *next;};linklist ma
2014-10-26 13:01:39
532
原创 拓扑排序
#include#include#include#include#include#includeusing namespace std;const int M=1005;struct linklist{ int s; linklist *next;};linklist map[M];int co[M];stacks;int a[M];int n, m;int t
2014-10-25 20:47:57
364
原创 galaxy
galaxy [Time Limit 1000MS] [Memory Limit 65536KB] [Description] 某陈和某Y最近对一个游戏着迷.那是Electronic Arts今年发布的优秀的模拟经营类游戏,Spore. 在Spore中,玩家将经历从单细胞生物到星系的统治者的进化过程,创造并守护你自己的文明. 而某陈在经历了几天*几十分钟/天的游戏
2014-10-24 21:05:13
618
2
原创 看望朋友
看望朋友【题目描述】话说运气极其不好的Yoyo_Yao在某年某月某日得了水痘,于是GoldenSun去看她。已知Yoyo_Yao家住x点,GoldenSun家住w点。GoldenSun从自己家坐车过去,中途可能经过一些点。从一个点到另一个店,有的有直接的直路相连,有的没有,可以从其它点绕行。由于急着见到Yoyo_Yao,GoldenSun必须尽快赶到。已知出租车收费1元/km。
2014-10-24 20:59:39
809
原创 CodeVs 1197 && noip 2012 Day1 Vigenère密码
这一纯粹是找规律,好水呀..不过在装换的时候要注意一下,不然很容易会wa...
2014-10-19 21:58:56
940
原创 Codeforces Round #268 (Div. 2) 就差一点就能上蓝了......
首先声明本学渣是绿名........大犇切勿鄙视.........
2014-09-20 23:30:16
779
原创 CodeVs 1225 八数码难题
1225 八数码难题题目描述DescriptionYours和zero在研究A*启发式算法.拿到一道经典的A*问题,但是他们不会做,请你帮他们.问题描述在3×3的棋盘上,摆有八个棋子,每个棋子上标有1至8的某一数字。棋盘中留有一个空格,空格用0来表示。空格周围的棋子可以移到空格中。要求解的问题是:给出一种初始布局(初始状态)和目标布局(为了使题目简单,设目标状态为123
2014-08-23 19:01:22
1074
原创 Codeforces Round #259 (Div. 2) A.Little Pony and Crystal Mine
这很明显是一道很水的模拟题..........也可以搜索,但是MAX n只是101,直接
2014-08-02 11:06:20
1024
原创 USACO--1.2 Transformations
下面是in数据的分享:http://yunpan.cn/QCt4PdegzEMm5 提取码 e95a
2014-07-30 20:18:10
648
原创 USACO--1.2 Milking Cows
这一题可以算是一题模拟题,比较简单,不过我Wa了两次。Wa1:没有考虑n=1的情况,wa了第一次。Wa2:没有考虑排序后第一个数据的区间可以包含其他数据,Wa了一次,幸亏是最后一次~~~~代码比较繁杂,不建议看~~~~(>_<)~~~~
2014-07-30 17:08:40
533
渗透神器 Brup Suite(破解版)
2014-06-23
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人