HDOJ(HDU) 1587 Flowers(水、、)】的更多相关文章

Problem Description As you know, Gardon trid hard for his love-letter, and now he's spending too much time on choosing flowers for Angel. When Gardon entered the flower shop, he was frightened and dazed by thousands kinds of flowers. "How can I choos…
Flowers Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3679    Accepted Submission(s): 2412 Problem Description As you know, Gardon trid hard for his love-letter, and now he's spending too muc…
Problem Description Jackson wants to know his rank in the class. The professor has posted a list of student numbers and marks. Compute Jackson's rank in class; that is, if he has the top mark(or is tied for the top mark) his rank is 1; if he has the…
题意:给出n种花的价钱,和总的金额m,问最多能够买到多少朵花.先排序,然后就是便宜的花在能够买的范围内能够多买就多买 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int a[10010]; int main() { int n,m,i,ans,r; while(scanf("%d %d",&am…
HDOJ(HDU).1058 Humble Numbers (DP) 点我挑战题目 题意分析 水 代码总览 /* Title:HDOJ.1058 Author:pengwill Date:2017-2-15 */ #include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #define nmax 6000 #define min(a,b) (a<b?a:b…
Flowers Problem Description As is known to all, the blooming time and duration varies between different kinds of flowers. Now there is a garden planted full of flowers. The gardener wants to know how many flowers will bloom in the garden in a specifi…
HDOJ(HDU).1412 {A} + {B} (STL SET) 点我挑战题目 题意分析 大水题,会了set直接用set即可. 利用的是set的互异性(同一元素有且仅有一项). #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <set> #define nmax 20005 using namespace std; s…
HDOJ(HDU).1754 I Hate It (ST 单点替换 区间最大值) 点我挑战题目 题意分析 从题目中可以看出是大数据的输入,和大量询问.基本操作有: 1.Q(i,j)代表求区间max(a[k]) k∈[i,j]: 2.U(i,j)代表a[i] = j; 对于询问U,用单点替换的操作维护线段树.对于询问Q,那么除了叶子节点,其他的节点应该保存的是左子树和右子树的最大值,因此pushup函数应该是对最大值的一个维护,query的时候找出的应该是最大值,故改为ans = max(--)…
HDOJ(HDU).1166 敌兵布阵 (ST 单点更新 区间求和) 点我挑战题目 题意分析 根据数据范围和询问次数的规模,应该不难看出是个数据结构题目,题目比较裸.题中包括以下命令: 1.Add(i,j)表示 a[i]+=j; 2.Sub(i,j)表示 a[i]-=j; 3.Query(i,j)表示 Σ(a[i],a[j]). Add操作和Sub操作分别是单点更新,Query是区间求和.题目比较裸,但是在写ST模板的时候还是不能一次写对,出的错记录如下: 1.由于对模板的不熟悉,rt打成rn导…
HDOJ(HDU).2844 Coins (DP 多重背包+二进制优化) 题意分析 先把每种硬币按照二进制拆分好,然后做01背包即可.需要注意的是本题只需要求解可以凑出几种金钱的价格,而不需要输出种数.因此用0表示不可以,1表示可以.最后对dp数组扫描一遍即可. 代码总览 #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #define nmax 100…