1. #include <iostream>
  2. #include <string>
  3. #include <algorithm>
  4.  
  5. using namespace std;
  6.  
  7. class WolfDelaymaster{
  8. public:
  9. bool checkChar(string str, char c, int start ,int num){
  10. for(int i = start; i < start + num; ++ i ){
  11. if(str[i] != c) return false;
  12. }
  13. return true;
  14. }
  15.  
  16. string check(string str){
  17. for(int i = ; i < str.length();){
  18. int j = i;
  19. while(str[j] == 'w' && ++ j);
  20. int num = j - i;
  21. if(num == ) return "INVALID";
  22. if(checkChar(str,'',j,num) && checkChar(str,'l',j+num,num) && checkChar(str,'f',j+*num,num))
  23. {
  24. i = j + *num;
  25. }
  26. else return "INVALID";
  27. }
  28. return "VALID";
  29. }
  30.  
  31. };

topcoder SRM 593 DIV2 WolfDelaymaster的更多相关文章

  1. topcoder SRM 593 DIV2 RaiseThisBarn

    #include <vector> #include <string> #include <list> #include <map> #include ...

  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. python __init__ __call__

    __call__ 和 __init__半毛钱的关系都没有. 后者是构造类的实例时会调用的方法,并不是构造方法. 前者是在实例上可以呼叫的方法.代码示例如下: >>> class fo ...

  2. sharepoint更新多行文本webparth

    前台 <script> function Copy() { var value = document.getElementById("<%=BodyBox.ClientID ...

  3. explict关键字

    [本文链接] http://www.cnblogs.com/hellogiser/p/explict.html [分析] explicit 只对构造函数起作用,用来抑制隐式转换. Suppose yo ...

  4. codeforces 474D.Flowers 解题报告

    题目链接:http://codeforces.com/problemset/problem/474/D 题目意思:Marmot 吃两种类型的花(实在难以置信呀--):red 或者 white,如果要吃 ...

  5. jquery去掉或者替换字符,设置指定options为selected状态

    <html> <body> <div><select id="queryYear">                 <opt ...

  6. Codeforces 389B(十字模拟)

    Fox and Cross Time Limit: 1000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u Submi ...

  7. ios获取一个文件夹下的文件(夹)列表

    NSArray* ary=[[NSFileManager defaultManager] contentsOfDirectoryAtPath:[[NSBundle mainBundle] pathFo ...

  8. [Android Memory] Android Zipalign zip对齐优化app程序

    转载地址:http://www.cnblogs.com/xirihanlin/archive/2010/04/12/1710164.html 参考文章:http://www.cnblogs.com/l ...

  9. Mac相关命令

    1,查询端口占用与Kill相应进程 lsof -i:端口,查询端口的占用情况 kill PID,关闭指定PID的进程. 如: localhost:~ tianjingcheng$ kill 729 l ...

  10. mysql:表注释和字段注释

    mysql:表注释和字段注释 1 创建表的时候写注释 create table test1 ( field_name int comment '字段的注释' )comment='表的注释'; 2 修改 ...