hzau 1210 Happiness
1210: Happiness
Time Limit: 1 Sec Memory Limit: 1280 MB
Submit: 1149 Solved: 301
[Submit][Status][Web Board]
Description
Chicken brother is very happy today, because he attained N pieces of biscuits whose tastes are A or B. These biscuits are put into a box. Now, he can only take out one piece of biscuit from the box one time. As we all know, chicken brother is a creative man. He wants to put an A biscuit and a B biscuit together and eat them. If he take out an A biscuit from the box and then he take out a B biscuit continuously, he can put them together and eat happily. Chicken brother’s happiness will plus one when he eat A and B biscuit together one time.
Now, you are given the arrangement of the biscuits in the box(from top to bottom) ,please output the happiness of Chicken Brother when he take out all biscuit from the box.
Input
The first line is an integer indicates the number of test cases.
In each case, there is one line includes a string consists of characters ‘A’ and ‘B’.
The length of string is not more than 1000000.
Output
For each test case:
The first line output “Case #k:", k indicates the case number.
The second line output the answer.
Sample Input
1
ABABBBA
Sample Output
Case #1:
2
HINT
hzau 1210 Happiness的更多相关文章
- BZOJ 2127: happiness [最小割]
2127: happiness Time Limit: 51 Sec Memory Limit: 259 MBSubmit: 1815 Solved: 878[Submit][Status][Di ...
- [置顶] [BZOJ]2127: happiness 最小割
happiness: Description 高一一班的座位表是个n*m的矩阵,经过一个学期的相处,每个同学和前后左右相邻的同学互相成为了好朋友.这学期要分文理科了,每个同学对于选择文科与理科有着自己 ...
- [补档]happiness
happiness 题目 传送门:http://cogs.pro/cogs/problem/problem.php?pid=1873 高一一班的座位表是个n×m的矩阵,经过一个学期的相处,每个同学和前 ...
- happiness[国家集训队2011(吴确)]
[试题来源] 2011中国国家集训队命题答辩 [问题描述] 高一一班的座位表是个n*m的矩阵,经过一个学期的相处,每个同学和前后左右相邻的同学互相成为了好朋友.这学期要分文理科了,每个同学对于选择文科 ...
- 【BZOJ2127】happiness(最小割)
[BZOJ2127]happiness(最小割) 题面 Description 高一一班的座位表是个n*m的矩阵,经过一个学期的相处,每个同学和前后左右相邻的同学互相成为了好朋友.这学期要分文理科了, ...
- bzoj——2127: happiness
2127: happiness Time Limit: 51 Sec Memory Limit: 259 MBSubmit: 2570 Solved: 1242[Submit][Status][D ...
- 【BZOJ】【2127】happiness
网络流/最小割 Orz Hzwer. 这题他题解说的比较简略……我手画了个图才明白过来…… 嗯对于每个人选文or理的单独收益大家应该很好理解……连S->i 权值为选文的喜悦值,i->T权值 ...
- A1261. happiness(吴确)[二元组暴力最小割建模]
A1261. happiness(吴确) 时间限制:500ms 内存限制:512.0MB 总提交次数:158 AC次数:72 平均分:56.71 将本题分享到: 查看 ...
- 【bzoj2127】happiness 最大流
happiness Time Limit: 51 Sec Memory Limit: 259 MBSubmit: 2579 Solved: 1245[Submit][Status][Discuss ...
随机推荐
- 当退出python时,是否释放全部内存
答案是no,循环引用其他对象或引用自全局命名空间的对象的模块,在python退出时并非完全释放 另外,也不会释放c库保留的内存部分
- nodejs socket server 强制关闭客户端连接
nodejs socket server 强制关闭客户端连接: client.destroy()
- python多线程编程(3): 使用互斥锁同步线程
问题的提出 上一节的例子中,每个线程互相独立,相互之间没有任何关系.现在假设这样一个例子:有一个全局的计数num,每个线程获取这个全局的计数,根据num进行一些处理,然后将num加1.很容易写出这样的 ...
- pyhton3 os模块
1 os.getcwd() 获取当前工作目录,即当前python脚本工作的目录路径 2 os.chdir("dirname") 改变当前脚本工作目录:相当于shell下cd 3 o ...
- smarty变量调节器与函数
smarty自带了一些变量调节器与内置函数,都在libs/plugins目录下,变量调节器以modifier开头,函数以function开头,而且我们可以自定义变量调节器与函数,熟练运用之后会极大地提 ...
- PAT 天梯赛 L1-020. 帅到没朋友 【STL】
题目链接 https://www.patest.cn/contests/gplt/L1-020 思路 对于每个 K >= 2 的朋友圈,里面的所有 ID 都用 MAP 标记一下 对于每个 K = ...
- vue(组件、路由)懒加载
const Login = resolve => require(['@/components/Login'], resolve) //就不用import了 Vue.use(Router) le ...
- 【HackerRank】The Love-Letter Mystery
James找到了他的朋友Harry要给女朋友的情书.James很爱恶作剧,所以他决定要胡搞一下.他把信中的每个单字都变成了回文.对任何给定的字符串,他可以减少其中任何一个字符的值,例如'd'可以变成' ...
- linux 网卡buffer大小
参考截取一部分:https://blog.csdn.net/ysu108/article/details/7764461 在linux下可以修改协议栈改变tcp缓冲相关参数: 修改系统套接字缓冲区 e ...
- 【Head First Servlets and JSP】笔记8:监听者
1.你不用了解所有监听者API,并不多,一共有8个.不过,你需要知道你能监听什么,以便在需要的时候可以查. 2.关于Session和Cookie.参见JavaWeb学习总结(十二)——Session ...