贪心
文章平均质量分 77
在路上-小武
这个作者很懒,什么都没留下…
展开
-
nyoj 344 Moonfang's Birthday(贪心,注意思想)
难度:3描述 It's Moonfang's birthday,and his friends decided to buy him a copy of XianJianQiXiaZhuan V.Since some of friends have more money available than others, nobody has to pay more than he can原创 2012-08-11 19:22:58 · 590 阅读 · 0 评论 -
hdu 1009 FatMouse' Trade(贪心)
struct数组用错,而且这个题不用考虑分母为0,还不报错,奇了怪了!!!Problem DescriptionFatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse containing his favorite food, JavaBean.The w原创 2012-07-28 14:12:45 · 245 阅读 · 0 评论 -
hdu 4310 heros
简单贪心#include#include#includeusing namespace std;struct point{ int x,y; double bl;}points[21];int cp(const void *a,const void *b){ struct point *c=(point *)a; struct point *d=原创 2012-07-30 14:36:08 · 345 阅读 · 0 评论 -
过河问题,谈论两种贪心策略
将单独过河所需要时间最多的两个旅行者送到对岸去,有两种方式:1> 最快的(即所用时间t[0])和次快的过河,然后最快的将船划回来,再次慢的和最慢的过河,然后次快的将船划回来.2> 最快的和最慢的过河,然后最快的将船划回来,再最快的和次慢的过河,然后最快的将船划回来.这样就将过河所需时间最大的两个人送过了河,而对于剩下的人,采用同样的处理方式,接下来做的就是判断怎样用的时间最少.1>原创 2012-11-15 08:54:16 · 447 阅读 · 0 评论 -
nyoj 贪心(动态规划也可,重点是贪心策略)Jumping Cows
7 2 1 8 4 3 5 6 可分成 7 (2 1) 8 (4 ,3) (5 6); 在奇数时间取上升序列中最大的,在偶数时间取下降序列中最小的。不过最后有一点需要注意,当整个序列进行完时,最后肯定是加上一个数,7 (2 1) 8 (4 3) (5 6) 1给你n个数,找一些数(可以不连续,但顺序不可乱),奇数位置的数+,偶数位置的数-。最后得出的最大结果是?从前往后搜,交替执行原创 2012-11-22 22:51:02 · 453 阅读 · 0 评论 -
算法作业(机器人登山问题,求逆序数)
作业1:求逆序数(归并排序求逆序数)//分治法:两个阶段,分和治,注意分和治的方法和边界条件import java.util.Arrays;import java.util.Scanner;public class Main { //定义数组Aarray和数组Barray大小 public static int [] Aarray=new int[1000010]; publi原创 2013-03-31 11:54:53 · 891 阅读 · 0 评论