
贪心
threeh20
暑假有半个月整个人像死了一样,所以更加明白生命的可贵
展开
-
hdu 5821 ball
BallTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1080 Accepted Submission(s): 649Problem DescriptionZZX has a sequence of boxe原创 2017-07-19 13:01:57 · 215 阅读 · 0 评论 -
zoj 3819 Average Score(贪心)
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3819 按照题意,不难得出,最终答案的下界为他自己班的平均分,上界为另一个班的平均分 #include<bits/stdc++.h>using namespace std;int main(){ int n,m; int t;...原创 2018-10-21 12:50:53 · 172 阅读 · 0 评论 -
hdu 5969 最大的位或(贪心)
http://acm.hdu.edu.cn/showproblem.php?pid=5969 对于一个l和r我们都看成2进制最优情况一定是1000和0111来异或这样就能得到在位数不可能改变的情况下能够得到的最大值,那么如果l到r能够存在这种情况就这么异或但如果l和r的位数相同,那么就保留前面相同位数上的0和1,一旦遇到不同则按照以上方法对低位取xxxxx1000和xxxx...原创 2018-10-21 12:45:52 · 148 阅读 · 0 评论 -
牛客国庆集训派对Day3 D Shopping(贪心)
https://www.nowcoder.com/acm/contest/203/D 尽量保证每个购物车都能有一个半价机会即可并且将这个半价尽量给较大的价格的物品 #include <bits/stdc++.h>using namespace std;#define ll long longconst int maxn=1e5+10;double a[m...原创 2018-10-12 20:35:43 · 140 阅读 · 0 评论 -
2018 Multi-University Training Contest 7 hdu 6396 Swordsman(贪心)
http://acm.hdu.edu.cn/showproblem.php?pid=6396我们将每个怪物的属性都分离开来,这样我们就得到5个数组,然后每个数组里都要记录一下该属性是哪只怪物的。然后将这5个数组从小到大排序5次。然后用5个指针去跑这5个数组,只要相应的属性大于当前属性,就将该属性对应的怪物的属性数量-1如果某种怪物的属性减到0的话。就让主角的属性加上该怪物的奖励。...原创 2018-08-13 18:26:11 · 196 阅读 · 0 评论 -
EOJ Monthly 2018.8 C. Channel On Live
https://acm.ecnu.edu.cn/contest/103/problem/C/ 区间的左右边界最大为1e9所以可以将左右边界缩小,而不改变覆盖关系。例如 100 500 , 300 600 这2个区间可以缩小成 1 3 和2 4 两个区间。 #include<bits/stdc++.h>using namespace std;int ...原创 2018-08-11 23:23:36 · 455 阅读 · 0 评论 -
CodeForces 39A C*++ Calculations
http://codeforces.com/problemset/problem/39/A根据题意,输进来的都是一个常数乘上一个c++ (c是题目给的数),我们可以将其视为一个单元,许多个单元之间用加号或者减号连接,每一个单元的计算先后顺序都是任意的,求最大结果。因为都是c++或者是++c,那么肯定是让减号开头的单元也就是常数是负数的先算,然后再算正的。排个序就可以了。#include<io...原创 2018-05-04 10:12:48 · 283 阅读 · 0 评论 -
hdu 5718 oracle
http://acm.hdu.edu.cn/showproblem.php?pid=5718#includeusing namespace std;char a[11111111];void co(int wz){ int jw=a[wz]-'0'; //cout<<wz<<endl; int i;原创 2017-11-11 21:16:39 · 216 阅读 · 0 评论 -
CodeForces 333A Secrets
http://codeforces.com/problemset/problem/333/A#includeusing namespace std;int main(){ long long int n; while(scanf("%I64d",&n)!=EOF) { long long int _3原创 2017-10-29 17:17:30 · 299 阅读 · 0 评论 -
CodeForces 332A Down the Hatch!
http://codeforces.com/problemset/problem/332/A#includeusing namespace std;int main(){ long long int n; while(scanf("%I64d",&n)!=EOF) { char a[2222]; cin>>a; int l=strlen(a原创 2017-10-29 17:18:26 · 409 阅读 · 0 评论 -
hdu 5935 Car
http://acm.hdu.edu.cn/showproblem.php?pid=5935#include using namespace std;long long int a[111111];long long int b[111111];int main(){ int T; cin>>T; int cs=1;原创 2017-10-21 11:06:54 · 286 阅读 · 0 评论 -
hdu 5938 Four Operations
http://acm.hdu.edu.cn/showproblem.php?pid=5938#include using namespace std; int main() { int t; int cs=1; char a[1111]; cin>>t; whi原创 2017-10-21 11:04:56 · 234 阅读 · 0 评论 -
codeforces 835b The number on the board
B. The number on the boardtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputSome natural number was written原创 2017-08-02 20:40:31 · 370 阅读 · 0 评论 -
HDU 6245 Rich Game(贪心)
http://acm.hdu.edu.cn/showproblem.php?pid=6245 不难发现,如果x>y的情况下,可以通过输一局赢一局来打到无限金钱。。所以是n那么其他情况,第一大局是一定不能赢的,那么干脆输11局 攒一波钱然后去看看赢一大局所花的钱,就这样攒一波赢一波 #include<bits/stdc++.h>using namesp...原创 2018-11-01 22:08:34 · 203 阅读 · 0 评论