Codeforces Round #419 (Div. 2) A-E】的更多相关文章

http://codeforces.com/contest/816/problem/E 题意: 去超市买东西,共有m块钱,每件商品有优惠卷可用,前提是xi商品的优惠券被用.问最多能买多少件商品? 思路: 第一件商品使用优惠券不需要前提,别的都是需要的,然后这样就形成了一棵以1为根的树. 这样,很容易想到是树形dp. d[u][j][0/1]表示以u为根的子数中选择j件商品所需的最少花费,0/1表示u商品是否能用优惠券. 解释一下代码中的sz[],它所代表的是以u为根的子树的结点数. 当我们现在访…
http://codeforces.com/contest/816/problem/B To stay woke and attentive during classes, Karen needs some coffee! Karen, a coffee aficionado, wants to know the optimal temperature for brewing the perfect cup of coffee. Indeed, she has spent some time r…
http://codeforces.com/contest/816/problem/A 题意: 给出一个时间,问最少过多少时间后是回文串. 思路: 模拟,先把小时的逆串计算出来: ① 如果逆串=分钟,那么此时已经是回文串了. ② 如果逆串>分钟,那么只需要逆串-分钟即可.(注意此时逆串>=60的情况) ③ 如果逆串<分钟,此时在这个小时内要构成回文串已经是不可能的了,那么就加上60-minute分钟,进入一个新的小时,然后重复上述步骤. #include<iostream>…
1.题目A:Karen and Morning 题意: 给出hh:mm格式的时间,问至少经过多少分钟后,该时刻为回文字符串? 思路: 简单模拟,从当前时刻开始,如果hh的回文rh等于mm则停止累计.否则,根据rh和mm的大小来累计sum,然后hh+1,不断尝试. #include<iostream> using namespace std; int main() { int hh,mm; char c; while (cin >> hh >> c >> mm…
A:暴力枚举第一列加多少次,显然这样能确定一种方案. #include<iostream> #include<cstdio> #include<cmath> #include<cstdlib> #include<cstring> #include<algorithm> using namespace std; #define ll long long #define N 110 char getc(){char c=getchar()…
python 2.7,用来熟悉Python 由于都是智障题,所以我也不讲述题意和题解,直接贴代码了-- A import sys h,m = map(int,raw_input().split(":")) ans = 0 while True: if h%10 == m/10 and h/10 == m%10: break ans = ans + 1 h,m = (h+m/59)%24,(m+1)%60 print ans B import sys maxn = 200005 # cl…
C. Karen and Game time limit per test 2 seconds memory limit per test 512 megabytes input standard input output standard output On the way to school, Karen became fixated on the puzzle game on her phone! The game is played as follows. In each level,…
To stay woke and attentive during classes, Karen needs some coffee! Karen, a coffee aficionado, wants to know the optimal temperature for brewing the perfect cup of coffee. Indeed, she has spent some time reading several recipe books, including the u…
传送门:Problem B https://www.cnblogs.com/violet-acmer/p/9721160.html 题意: Karen有n个关于煮咖啡的食谱,每个食谱都有个煮咖啡的最适宜的温度范围,给你 m 个操作,每个操作都是个温度区间,问在此区间内满足条件的温度个数. 需要满足的条件为:在温度 T 时,在n个食谱中查找最宜温度包含T的食谱个数,只有当食谱个数 >= k 时,此温度才算可以计入答案. 题解: 差分数组 AC代码: #include<iostream> #…
A. Karen and Morning time limit per test 2 seconds memory limit per test 512 megabytes input standard input output standard output Karen is getting ready for a new school day! It is currently hh:mm, given in a 24-hour format. As you know, Karen loves…