Codeforces Round #419 A+B】的更多相关文章

Karen has just arrived at school, and she has a math test today! The test is about basic addition and subtraction. Unfortunately, the teachers were too busy writing tasks for Codeforces rounds, and had no time to make an actual test. So, they just pu…
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…
On the way home, Karen decided to stop by the supermarket to buy some groceries. She needs to buy a lot of goods, but since she is a student her budget is still quite limited. In fact, she can only spend up to b dollars. The supermarket sells n goods…
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…
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 palindromes, and she believes that it is good luck to wake up when the time is a palindrome. What is the minimum number of minutes…
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()…