随笔分类 -  贪心

摘要:Solutions A. Creating a Character 题意: 给出初始体力值$str$和智力值$int$,然后你可以把$exp$分别分配给这两个数值,使得分配后$str int$,求有多少种分配方案。 思路: 特判不可能情况:$str + exp int$,乱搞 正解: 假设分别分配给 阅读全文
posted @ 2019-09-13 18:08 Frontierone 阅读(210) 评论(0) 推荐(0)
摘要:Solutions A. There Are Two Types Of Burgers 题意: 做一个$A$需要两个$b$和两个$p$,能卖$h$元;做一个$B$需要两个$b$和两个$f$,能卖$c$元。给出$b,p,f$的数量,求最多卖多少元。 思路: 比赛的时候用循环搞了,判断$h,c$的大小关 阅读全文
posted @ 2019-08-27 14:41 Frontierone 阅读(225) 评论(0) 推荐(0)
摘要:Solutions A. Hotelier 题意: 对应$n$个位置,如果是$L$,左边第一个为$0$的位置变为$1$,如果是$R$,右边第一个为$0$的位置变为$1$,如果是数字,对应位置变为$0$。 思路: 模拟即可。但是比赛就是无语,这么辣鸡的题目,竟然用数字判字符$0$…… cpp // d 阅读全文
posted @ 2019-08-18 18:36 Frontierone 阅读(163) 评论(0) 推荐(0)
摘要:A:Remainder 遍历一遍就可以了。 1 #include<bits/stdc++.h> 2 using namespace std; 3 4 char s[200010]; 5 int main() { 6 int n,x,y; 7 scanf("%d%d%d",&n,&x,&y); 8 s 阅读全文
posted @ 2019-05-17 19:39 Frontierone 阅读(187) 评论(0) 推荐(0)
摘要:A:模拟,出现重复的break。 1 #include <bits/stdc++.h> 2 #define lowbit(x) (x)&(-x) 3 #define il inline 4 #define lson l,mid-1,now 5 #define rson mid+1,r,now 6 # 阅读全文
posted @ 2019-04-28 21:12 Frontierone 阅读(138) 评论(0) 推荐(0)
摘要:Xor and Sum 之前做过一道异或的。感觉有点眼熟,发现不是。由于对异或一点也不熟悉。所以直接放弃了 首先写出来几项看看。 a: 1 2 4 1 1 2 4 prex : 1 3 7 6 7 5 1 prey: 1 3 7 8 9 11 15 可以发现如果区间异或和==区间和,那么缩小区间还是 阅读全文
posted @ 2019-04-12 19:07 Frontierone 阅读(210) 评论(0) 推荐(0)
摘要:Distinct Values Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4869 Accepted Submission(s): 1659 阅读全文
posted @ 2018-09-09 15:20 Frontierone 阅读(228) 评论(0) 推荐(1)
摘要:Balanced Sequence Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6207 Accepted Submission(s): 16 阅读全文
posted @ 2018-09-08 15:14 Frontierone 阅读(291) 评论(1) 推荐(0)
摘要:Problem F: F BUYING FEEDDescriptionFarmer John needs to travel to town to pick up K (1 using namespace st... 阅读全文
posted @ 2018-05-14 17:47 Frontierone 阅读(232) 评论(0) 推荐(0)