贪心
文章平均质量分 58
AC_XXZ
努力了不一定会成功,但不努力肯定会失败
展开
-
hdu1009
题意:给你原创 2014-05-13 20:20:36 · 890 阅读 · 0 评论 -
Codeforces 437C The Child and Toy( 贪心)
题意: 一个玩具有n个点,m条边,每个点都有一个权值,现在要拆除玩具,将每个点拿出来,每拆除一个点消耗的能量为与这个点相关联的所有点的权值和,问拆除所有点所需最小能量思路: 可以将问题转换成拆除所有边的最小权值,只不过权值在点上面 ,当求得最小值的时候,必然是所有的边都已经去掉了。也就是说,无论以什么样的顺序去掉这些边,得到最终的结果时所有边都已经去掉了,而我们就是只要结果。去每一条边的时候,原创 2015-08-14 14:15:21 · 1287 阅读 · 0 评论 -
codeforces 204(Div.1 A) Little Elephant and Interval(贪心)
题意: 有一种个位数与最高位数字相等的数字,求在l,r的范围内,这种数字的个数。 思路: 找下规律就知道当当n>10的时候除去个位以后的答案等于n/10,然后考虑第一个数字是否小于最后一个,小于减一,还要加上个位一定存在的9位数 import java.util.Scanner;public class xxz { public static void main(String[] ar原创 2015-08-14 15:58:34 · 1106 阅读 · 0 评论 -
不重叠的线段
X轴上有N条线段,每条线段有1个起点S和终点E。最多能够选出多少条互不重叠的线段。(注:起点或终点重叠,不算重叠)。 例如:[1 5][2 3][3 6],可以选[2 3][3 6],这2条线段互不重叠。思路:贪心,就是以前的安排节目的题目,在这里将线段末端点按照从小到大排序,就跟哪个活动结束早哪个先安排#include <iostream> #include <cstdio> #include原创 2015-08-27 20:36:49 · 2168 阅读 · 0 评论 -
喷水装置(二)
喷水装置(二) 时间限制:3000 ms | 内存限制:65535 KB 难度:4 描述有一块草坪,横向长w,纵向长为h,在它的橫向中心线上不同位置处装有n(n<=10000)个点状的喷水装置,每个喷水装置i喷水的效果是让以它为中心半径为Ri的圆都被润湿。请在给出的喷水装置中选择尽量少的喷水装置,把整个草坪全部润湿。 输入第一行输入一个正整数N表示共有n次测原创 2015-01-06 00:22:03 · 1047 阅读 · 0 评论 -
喷水装置(一)
喷水装置(一) 时间限制:3000 ms | 内存限制:65535 KB 难度:3 描述现有一块草坪,长为20米,宽为2米,要在横中心线上放置半径为Ri的喷水装置,每个喷水装置的效果都会让以它为中心的半径为实数Ri(0<Ri<15)的圆被湿润,这有充足的喷水装置i(1<i<600)个,并且一定能把草坪全部湿润,你要做的是:选择尽量少的喷水装置,把整个草坪的全部湿润。原创 2015-01-06 00:19:40 · 1325 阅读 · 0 评论 -
poj3617(字典序最小问题)
#include #include #include using namespace std; int n,m; char S[2100],P[2100]; int main() { #ifdef xxz freopen("in.txt","r",stdin); #endif // xxz ios::sync_with_stdio(false); cin.tie(0原创 2015-02-09 18:07:13 · 989 阅读 · 0 评论 -
POJ3069(贪心)
#include #include #include #include using namespace std; int N,R; int x[2100]; int main() { #ifdef xxz freopen("in.txt","r",stdin); #endif // xxz ios::sync_with_stdio(false); cin.tie(原创 2015-02-09 18:04:08 · 823 阅读 · 0 评论 -
POJ3617(字典序最小问题)
书中43页 此题有坑点,PE了40分钟.也是醉了....题目要求每80个字符才换行,而且最后一个如果恰好就不用换,这不是无聊嘛....... #include #include #include using namespace std; int n,m; char S[2100],P[2100]; int main() { #ifdef xxz freopen("in.txt"原创 2015-02-01 23:37:36 · 901 阅读 · 0 评论 -
2014ACM/ICPC亚洲区域赛现场赛D和K题解题报告
Domination Time Limit: 8 Seconds Memory Limit: 131072 KB Special Judge Edward is the headmaster of Marjar University. He is enthusiastic about chess and often plays chess with his frie原创 2014-10-14 21:12:43 · 1482 阅读 · 3 评论 -
NYOJ14会场安排问题(区间求值)
会场安排问题 时间限制:3000 ms | 内存限制:65535 KB 难度:4 描述学校的小礼堂每天都会有许多活动,有时间这些活动的计划时间会发生冲突,需要选择出一些活动进行举办。小刘的工作就是安排学校小礼堂的活动,每个时间最多安排一个活动。现在小刘有一些活动计划的时间表,他想尽可能的安排更多的活动,请问他该如何安排。 输入第一行是一个整型数m(m 每组原创 2015-01-06 14:26:37 · 898 阅读 · 0 评论 -
Codeforces Round #275 (Div. 2)
C. Diverse Permutation time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Permutation p is an ordered set of in原创 2014-11-29 19:41:43 · 940 阅读 · 0 评论 -
Codeforces Round #273 (Div. 2)
A. Initial Bet time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There are five people playing a game called "原创 2014-10-18 15:46:19 · 1743 阅读 · 0 评论 -
Codeforces Round #276 (Div. 2)(C)
C. Bits time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Let's denote as the number of bits set ('1' bits)原创 2014-11-19 21:34:01 · 852 阅读 · 0 评论 -
最小的n个和(STL堆的运用)
最小的n个和 Time Limit: 1000 MS Memory Limit: 32768 K Total Submit: 109(26 users) Total Accepted: 22(19 users) Rating: Special Judge: No Description 给定A原创 2014-11-03 20:59:20 · 1420 阅读 · 0 评论 -
Codeforces Round #277.5 (Div. 2)(C题)
C. Given Length and Sum of Digits... time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You have a positive int原创 2014-11-19 21:29:31 · 1104 阅读 · 0 评论 -
男女舞伴贪心
H.Dance Floor Time Limit: 1000 MS Memory Limit: 32768 K Total Submit: 177 (39 users) Total Accepted: 19 (17 users) Special Judge: No Description Ma原创 2014-10-06 16:37:12 · 1338 阅读 · 0 评论 -
2015多校联合训练第一场Assignment(hdu5289)三种解法
题目大意:给出一个数列,问其中存在多少连续子序列,子序列的最大值-最小值#include <iostream> #include <cstdio> #include <algorithm> #include <string> #include <cmath> using namespace std;int maxsum[100000][30]; int minsum[100000][30];int原创 2015-07-24 22:32:02 · 1379 阅读 · 0 评论
分享