topcoder SRM 593 DIV2 RaiseThisBarn
#include <vector>
#include <string>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <climits>
#include <queue> using namespace std; class RaiseThisBarn
{
public:
int calc(string str){
int num = count(str.begin(),str.end(),'c');
if(num == ) return str.length()-;
else if(num% != ) return ;
else{
int c_num =,i;
for(i = ; i < str.length()&& c_num < num/; ++ i){
if(str[i] == 'c') c_num++;
}
int firstPart = i,lastPart = i;
for(; i <str.length(); ++ i){
if(str[i] == 'c') {lastPart = i;break;}
}
return lastPart - firstPart+;
}
}
topcoder SRM 593 DIV2 RaiseThisBarn的更多相关文章
- topcoder SRM 593 DIV2 WolfDelaymaster
#include <iostream> #include <string> #include <algorithm> using namespace std; cl ...
- Topcoder Srm 673 Div2 1000 BearPermutations2
\(>Topcoder \space Srm \space 673 \space Div2 \space 1000 \space BearPermutations2<\) 题目大意 : 对 ...
- Topcoder Srm 671 Div2 1000 BearDestroysDiv2
\(>Topcoder \space Srm \space 671 \space Div2 \space 1000 \space BearDestroysDiv2<\) 题目大意 : 有一 ...
- 求拓扑排序的数量,例题 topcoder srm 654 div2 500
周赛时遇到的一道比较有意思的题目: Problem Statement There are N rooms in Maki's new house. The rooms are number ...
- Topcoder srm 632 div2
脑洞太大,简单东西就是想复杂,活该一直DIV2; A:水,基本判断A[I]<=A[I-1],ANS++; B:不知道别人怎么做的,我的是100*N*N;没办法想的太多了,忘记是连续的数列 我们枚 ...
- topcoder SRM 628 DIV2 BracketExpressions
先用dfs搜索所有的情况,然后判断每种情况是不是括号匹配 #include <vector> #include <string> #include <list> # ...
- topcoder SRM 628 DIV2 BishopMove
题目比较简单. 注意看测试用例2,给的提示 Please note that this is the largest possible return value: whenever there is ...
- Topcoder SRM 683 Div2 B
贪心的题,从左向右推过去即可 #include <vector> #include <list> #include <map> #include <set&g ...
- Topcoder SRM 683 Div2 - C
树形Dp的题,根据题意建树. DP[i][0] 表示以i为根节点的树的包含i的时候的所有状态点数的总和 Dp[i][1] 表示包含i结点的状态数目 对于一个子节点v Dp[i][0] = (Dp[v] ...
随机推荐
- Windows Server 2012 GUI与Core的切换
Server Core是在Windows Server 2008 系统上开始引入的极小的服务器安装选项,server core 的作用就是为特定的服务提供一个可执行的功能有限的低维护服务器环境,为我们 ...
- iptables 命令介绍
http://www.cnblogs.com/wangkangluo1/archive/2012/04/19/2457072.html iptables 防火墙可以用于创建过滤(filter)与NAT ...
- 《ASP.NET MVC4 WEB编程》学习笔记------ViewBag、ViewData和TempData的使用和区别
本文转自大卫Baby ViewBag和ViewData其实是互通的ViewBag和ViewData的区别:ViewBag 不再是字典的键值对结构,而是 dynamic 动态类型,它会在程序运行的时候动 ...
- POJ 1017
http://poj.org/problem?id=1017 题意就是有6种规格的物品,给你一些不同规格的物品,要求你装在盒子里,盒子是固定尺寸的也就是6*6,而物品有1*1,2*2,3*3,4*4, ...
- Linux系统排查1——内存篇
常见工作中,计算机系统的资源主要包括CPU,内存,硬盘以及网络,过度使用这些资源将使系统陷入困境.本系列一共四篇博文,结合我在实习期间的学习,介绍一些常见的Linux系统排障工具及方法. 第1篇——内 ...
- onsubmit="return false;"报错
<form id="formpersonal" method="post" onsubmit="return false;">. ...
- redis的单实例配置+web链接redis
[root@cache01 src]# wget http://download.redis.io/redis-stable.tar.gz [root@cache01 src]# tar -xzvf ...
- nginx: [warn] conflicting server name "locahost" on 0.0.0.0:80, ignored
里面域名重复: 在vhosts下多个虚拟机配置文件,都是基于域名配置的,其中两个配置文件,都起了localhost ,所以会报错!!!! 多个域名可以指向同一个目录,但同一个域名不可一指向多个目录!! ...
- MySQL监控
http://blog.csdn.net/zreodown/article/details/8158469
- oracle 10g 学习之服务器端安装(1)
Oracle 简介 lOracle 是殷墟出土的甲骨文(oracle bone inscriptions)的英文翻译的第一个单词 lOracle 公司是全球最大的信息管理软件及服务供应商,成立于197 ...