topcoder SRM 593 DIV2 WolfDelaymaster
#include <iostream>
#include <string>
#include <algorithm> using namespace std; class WolfDelaymaster{
public:
bool checkChar(string str, char c, int start ,int num){
for(int i = start; i < start + num; ++ i ){
if(str[i] != c) return false;
}
return true;
} string check(string str){
for(int i = ; i < str.length();){
int j = i;
while(str[j] == 'w' && ++ j);
int num = j - i;
if(num == ) return "INVALID";
if(checkChar(str,'',j,num) && checkChar(str,'l',j+num,num) && checkChar(str,'f',j+*num,num))
{
i = j + *num;
}
else return "INVALID";
}
return "VALID";
} };
topcoder SRM 593 DIV2 WolfDelaymaster的更多相关文章
- topcoder SRM 593 DIV2 RaiseThisBarn
#include <vector> #include <string> #include <list> #include <map> #include ...
- 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] ...
随机推荐
- HDOJ 1312 DFS&BFS
Red and Black Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) To ...
- django静态文件查找逻辑
最近被django的静态文件配置整疯了. 决定直捣黄龙,看看底层代码: 首先用manage finstatic xxxx.js 看看处理逻辑,发现主要在:C:\Python27\Lib\site-pa ...
- 15 day 1代碼
第一题 用堆维护. #include <cstdio> #include <algorithm> #include <queue> int n,i,f[400000 ...
- discuz特殊主题插件开发步骤和犯的愚蠢错误
discuz作为国内流行的论坛系统,可谓造福了不少趣味相投的网友们.它让天南地北.国内外有着共同兴趣爱好的人们聚集在一起,分享彼此的喜怒哀乐.心得体会.然而作为discuz的使用者之一,还是个码农,然 ...
- 用php计算行列式
因为有课程设计要计算多元一次方程组,所以想编个程序实现,多元一次方程组的计算最系统的方法就是利用克拉默法则求解方程组,所以只需要编写一个类或者方法求出多元一次方程组系数行列式的值和和其他几个行列式,如 ...
- Heap:Sunscreen(POJ 3614)
晒太阳 题目大意:一堆牛,为了避免晒太阳会灼烧自己,然后他们自己有自己的防晒指数(一个区间),防晒霜可以提高防晒因数SPF,大了不行小了不行,现在有一桶防晒霜,他们提供一定的SPF,但是最多可以提供k ...
- Could not create the view: An unexpected exception was thrown. 电脑突然断电,myeclipse非正常关闭,出现错误
电脑突然断电,myeclipse非正常关闭,“Package Explorer”非正常显示,出现错误“Could not create the view: An unexpected exceptio ...
- 【USACO】beads
题目: You have a necklace of N red, white, or blue beads (3<=N<=350) some of which are red, othe ...
- 使用apktool工具遇到could not decode arsc file的解决办法
问题详情: 当前环境为 win7 64位 jdk1.7 apktool.jar(版本1.5.2) apktool(版本windows-r05-ibot) 使用的反编译工具和apk文件为 反编译 ...
- MVC准备前基础知识
一.自动属性C#自动属性可以避免原来这样我们手工声明一个私有成员变量以及编写get/set逻辑public class Product{ public int Id { get; set; } pub ...