#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的更多相关文章

  1. topcoder SRM 593 DIV2 WolfDelaymaster

    #include <iostream> #include <string> #include <algorithm> using namespace std; cl ...

  2. Topcoder Srm 673 Div2 1000 BearPermutations2

    \(>Topcoder \space Srm \space 673 \space Div2 \space 1000 \space BearPermutations2<\) 题目大意 : 对 ...

  3. Topcoder Srm 671 Div2 1000 BearDestroysDiv2

    \(>Topcoder \space Srm \space 671 \space Div2 \space 1000 \space BearDestroysDiv2<\) 题目大意 : 有一 ...

  4. 求拓扑排序的数量,例题 topcoder srm 654 div2 500

    周赛时遇到的一道比较有意思的题目: Problem Statement      There are N rooms in Maki's new house. The rooms are number ...

  5. Topcoder srm 632 div2

    脑洞太大,简单东西就是想复杂,活该一直DIV2; A:水,基本判断A[I]<=A[I-1],ANS++; B:不知道别人怎么做的,我的是100*N*N;没办法想的太多了,忘记是连续的数列 我们枚 ...

  6. topcoder SRM 628 DIV2 BracketExpressions

    先用dfs搜索所有的情况,然后判断每种情况是不是括号匹配 #include <vector> #include <string> #include <list> # ...

  7. topcoder SRM 628 DIV2 BishopMove

    题目比较简单. 注意看测试用例2,给的提示 Please note that this is the largest possible return value: whenever there is ...

  8. Topcoder SRM 683 Div2 B

    贪心的题,从左向右推过去即可 #include <vector> #include <list> #include <map> #include <set&g ...

  9. Topcoder SRM 683 Div2 - C

    树形Dp的题,根据题意建树. DP[i][0] 表示以i为根节点的树的包含i的时候的所有状态点数的总和 Dp[i][1] 表示包含i结点的状态数目 对于一个子节点v Dp[i][0] = (Dp[v] ...

随机推荐

  1. Centos下samba共享打印机

    先说需求,公司有一台型号为HP LaserJet m1120 mfp的打印机,由于不是网络打印机使用起来十分不便,公司老大要求将这台打印机连在公司的内网linux服务器上(CentOS),然后配置sa ...

  2. map遍历

    Set<Map.Entry<String,String>> ss = params.entrySet(); for(Map.Entry<String,String> ...

  3. Linux匿名管道与命名管道

    http://blog.chinaunix.net/uid-26000296-id-3408970.html /* * \File * main.c * \Descript * father-proc ...

  4. php+phpquery简易爬虫抓取京东商品分类

    这是一个简单的php加phpquery实现抓取京东商品分类页内容的简易爬虫.phpquery可以非常简单地帮助你抽取想要的html内容,phpquery和jquery非常类似,可以说是几乎一样:如果你 ...

  5. Hadoop入门程序WordCount的执行过程

    首先编写WordCount.java源文件,分别通过map和reduce方法统计文本中每个单词出现的次数,然后按照字母的顺序排列输出, Map过程首先是多个map并行提取多个句子里面的单词然后分别列出 ...

  6. FastReport for delphi xe 安装步骤

    FastReport for delphi xe 安装步骤 1.先关闭DELPHI:2.下载后解压到一个目录,比如:D:FR:3.打开D:FR,运行recompile.exe ->点击" ...

  7. HDU1004 查气球

    Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Oth ...

  8. HDU5072 容斥原理

    G - Coprime Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit ...

  9. WebSocket技术

    webSocket技术 在html5技术革新中,加入了WebSocket技术 1.webSocket实际是TCP连接 webSocket在最初将发送http连接请求到服务器端, 但是在header中加 ...

  10. July 28th, Week 31st Thursday, 2016

    Time is a bird flying into eternity. 时间是一只永远在飞翔的鸟儿. Time waits for nobody. Vitality shows in not onl ...