CodeForces - 43B Letter】的更多相关文章

字符串的处理 统计已有字符的个数 和需求字符比较 #include <iostream> #include <stdio.h> #include <string.h> using namespace std; ]; ]; ]; int main() { freopen("in.txt", "r", stdin); gets(input); ; i < strlen(input); i++) { if (input[i] &g…
题目链接:http://codeforces.com/problemset/problem/180/C 题意: 有一段字符串,包含大小写字母,每次可以将其中一个字母由大写变成小写,或者小写变成大写.要求这个字符串最终变成任意大写字母都在任意小写字母的前面的情况.问最少变换多少个字母可达到要求. 题解: $f[i][0,1]$ 表示前 $i$ 个字母,第 $i$ 个字母为 $0$大写 / $1$小写,最少要改变的字母数. AC代码: #include<bits/stdc++.h> #define…
就像title说的,是昨天(2017/9/17)周赛的两道水题…… 题目链接:http://codeforces.com/problemset/problem/14/A time limit per test: 1 second memory limit per test: 64 megabytes A boy Bob likes to draw. Not long ago he bought a rectangular graph (checked) sheet with n rows and…
题目链接:http://codeforces.com/problemset/problem/180/C 题意: 给你一个仅包含大写字母和小写字母的字符串,你可以将让小写字母转化为大写字母,大写字母转化为小写字母,求最好的操作步数使得最后的字符串左边全是大写字母,右边全是小写字母. 思路: 有点像是树状DP,把每个字母看成一个节点,后一个字母为前一个字母的父节点.给予每个节点两种状态: 状态一(dplow[i]) : 当字符串长度为 i 时,第 i 个字母为小写(转化后),得到符合条件的字符串的最…
题目链接:http://codeforces.com/problemset/problem/180/C 题意: 给你一个字符串s,长度为n. 让你将这个字符串变成“前面一段都是大写字母,后面一段都是小写字母”的形式. (也可以全是大写或全是小写) 问你最少改动几个字符. 题解: 表示状态: dp[i][0/1] = min changes 表示考虑到第i个字符,s[i]改成了大写(1)或小写(0)时的最小代价 找出答案: ans = min(dp[n][0], dp[n][1]) 如何转移: d…
A. Watching a movie time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You have decided to watch the best moments of some movie. There are two buttons on your player: Watch the current minute…
http://codeforces.com/problemset/problem/499/B B. Lecture     You have a new professor of graph theory and he speaks very quickly. You come up with the following plan to keep up with his lecture and make notes. You know two languages, and the profess…
问题 A: 剪纸片 时间限制: 1 Sec 内存限制: 128 MB 题目描写叙述 这是一道简单的题目,假如你身边有一张纸.一把剪刀.在H-star的比赛现场,你会这么做: 1. 将这张纸剪成两片(平行于短边剪开): 2. 将当中一片剪成一个圆.作为圆柱的底面. 3. 纸的还有一片的一边沿着圆的周长将圆围起来,直到围成一圈.形成一个无盖的圆柱体. 须要注意的是,纸片可能会有重叠部分. 聪明的你机智的你喜欢思考的你这时候就開始想,一张纸片按上述方式所组成的圆柱的最大体积是多少呢?请你用编程解决问题…
C. Letter Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/180/problem/C Description Patrick has just finished writing a message to his sweetheart Stacey when he noticed that the message didn't look fancy. Patrick was nervou…
A. Letter 题目连接: http://www.codeforces.com/contest/14/problem/A Description A boy Bob likes to draw. Not long ago he bought a rectangular graph (checked) sheet with n rows and m columns. Bob shaded some of the squares on the sheet. Having seen his mas…