贪心
南宫嘉俊
学生
展开
-
coderforce 527A Arrays
题意:给你两个数组。问,在数组A中随便选K个,在数组中随便选M个,问你,是否有可能所选的数中,B中的数都比A中的大。 简单贪心#include #include #include using namespace std; #define LL long long const LL maxm=1e5+10; LL a[maxm]; LL b[maxm]; int main() { LL n原创 2015-10-20 16:34:28 · 456 阅读 · 0 评论 -
coderforce 545D Queue
题意:给你一串数,这些数字分别代表每个人最多等待的时间,当他等待的时间超过这个时间,他就会离开,#include #include #include using namespace std; #define LL long long const LL maxm=1e5+10; LL a[maxm]; int main() { LL n; while(scanf("%lld",&n)原创 2015-11-10 15:24:14 · 277 阅读 · 0 评论 -
HDU 5055 Bob and math problem
简单贪心#include #include #include using namespace std; const int maxm=105; const int inf=101; int a[maxm]; int main() { int n; while(scanf("%d",&n)!=EOF) { int MIN=inf,w,i,temp,ok=0;原创 2015-10-10 15:37:34 · 258 阅读 · 0 评论 -
HDU 2546 饭卡(01背包)
饭卡 Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 17430 Accepted Submission(s): 6070 Problem Description 电子科大本部食堂的饭卡有一种很诡异的设计,即原创 2015-11-11 14:59:33 · 320 阅读 · 0 评论 -
BestCoder Round #62 (div.2) Clarke and food
Clarke and food Accepts: 353 Submissions: 962 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) 问题描述 克拉克是一名人格分裂患者。某一天,克拉克变成了一个厨师,在采购食品。 克拉克一原创 2015-11-15 17:47:43 · 454 阅读 · 0 评论 -
coderforce 588A Duff and Meat(简单的贪心)
#include #include #include using namespace std; #define LL long long const LL maxm=1e5+10; LL a[maxm],p[maxm]; int main() { LL n; while(scanf("%lld",&n)!=EOF) { for(LL i=0;i<n;i++)原创 2015-10-16 09:28:59 · 416 阅读 · 0 评论 -
coderforce 500B New Year Permutation
题意:序列 a1, a2, ..., an , b1, b2, ..., bn, 如果存在整数 k (1 ≤ k ≤ n) 符合 a1 = b1, a2 = b2, ..., ak - 1 = bk - 1 并且 ak bk . 则称 a 序列比 b序列好。 题目给出一个序列 p ,再给出一个n*n的矩阵A , A[i][j] = 1 ,表示p中第i个元素能跟第j个元素交换原创 2015-11-23 21:00:13 · 333 阅读 · 0 评论 -
Codeforces Round #334 (Div. 2) B. More Cowbell
题意:要将n个物品放在k个背包里,且,每个背包最多装两个物品,每个背包的容积大小相同,求背包的容积最小为多少。 解:贪心的思想,先将小的跟大的放在一起,让后求最大。#include #include #include using namespace std; const int maxm=1e5+10; int a[maxm]; int main() { int n,k; whi原创 2015-12-02 16:09:37 · 264 阅读 · 0 评论 -
51ND 1432 独木舟
提问 31 南宫嘉俊 插入图片 本地图片 引用图片 (支持 JPG、GIF、PNG 格式,不要超过 2MB) 确定 关闭原创 2016-05-31 15:24:48 · 694 阅读 · 0 评论