因为cf上一堆水题,每个单独开一篇博客感觉不太好,就直接放一起好了. CF1096D Easy Problem 给定字符串,每个位置删除要代价.求最小代价使之不含子序列"hard". 设f[i][f]表示前i个删到只匹配f位子序列的最小代价.转移看代码吧.O(n) #include <bits/stdc++.h> typedef long long LL; ; int a[N]; LL f[N][]; char str[N]; int main() { int n; sca…
D. Stressful Training 题目链接:https://codeforces.com/contest/1132/problem/D 题意: 有n台电脑,每台电脑都有初始电量ai,也有一个耗电量bi,意即每1s耗电多少,现在你有一个充电器,它每s可以给一台电脑充x的点亮. 问x最少为多少,可以让所有电脑直至k时刻,点亮都不小于0. 题解: 我们考虑贪心,先给最需要充电的电脑充电,然后二分答案x去检验.大概思路就是这样吧...但是实现起来还是有点困难. 首先处理出每个电脑最晚需要充电的…
A.Regular bracket sequence A string is called bracket sequence if it does not contain any characters other than "(" and ")". A bracket sequence is called regular if it it is possible to obtain correct arithmetic expression by inserting…
Area of Mushroom Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2390 Accepted Submission(s): 578 Problem Description Teacher Mai has a kingdom with the infinite area. He has n students guard…