
pat-a-贪心
文章平均质量分 71
要认认真真
这个作者很懒,什么都没留下…
展开
-
1070. Mooncake (25)
点击打开链接#include #include using namespace std;#define MAX 1010struct goods{ double amount; double price; double bi;}g[MAX];int n,d;bool cmp(goods a,goods b){ return a.bi>b.bi;}int原创 2015-02-10 16:20:35 · 283 阅读 · 0 评论 -
1044. Shopping in Mars (25)
点击打开链接有一点超时,感觉这是dp#include #include #include using namespace std;map ans;int d[100010],h[100010];int main(){ freopen("in.txt","r",stdin); int n,m,start=-1,mind=123123123; scanf("%原创 2015-02-12 10:28:49 · 234 阅读 · 0 评论 -
1033. To Fill or Not to Fill (25)
点击打开链接贪心-。-先把样例搞清楚,会有很多启发!!!策略:先按照距离排序1.先找距离范围内,第一个低于当前位置的加油站(最低的策略不是最优,因为最低的价格总会遇到,若此次选择最低,那么前面的次低会被忽略),加适量的油(因为价格不最低)能够到达即可2.如果没有低于当前距离的,则当前位置是最小的,(贪心啊)应该加满油。先判断是该位置是否可以到终点,如果不能,再找原创 2015-02-11 14:50:54 · 237 阅读 · 0 评论 -
1037. Magic Coupon (25)
点击打开链接#include#include long long c[100010],pzheng[100010],b[100010],pfu[100010];using namespace std;bool big(long long a,long long b){ return a>b;}bool lit(long long a,long long b){ return原创 2015-02-11 17:05:00 · 316 阅读 · 0 评论