Test instructions: Ask you if you have a string with 5 identical intervals and the values are ' * '.
Ideas for solving problems: enumerating
Problem Solving Code:
1 //File name:a.cpp2 //Author:darkdream3 //Created time:2015 April 05 Sunday 00:33 59 seconds4 5#include <vector>6#include <list>7#include <map>8#include <Set>9#include <deque>Ten#include <stack> One#include <bitset> A#include <algorithm> -#include <functional> -#include <numeric> the#include <utility> -#include <sstream> -#include <iostream> -#include <iomanip> +#include <cstdio> -#include <cmath> +#include <cstdlib> A#include <cstring> at#include <ctime> - #defineLL Long Long - - using namespacestd; - Charstr[1005]; - intOK =0 ; in intMain () { - intN; toscanf"%d",&n); +scanf"%s", &str[1]); - for(inti =1; I < N;i + + ) the { * if(Str[i] = ='*') $ for(intj =1; J <= -; j + +)Panax Notoginseng { - if(i +4* J <= N && str[i+j] = ='*'&& str[i+2*J] = ='*'&& str[i+3*J] = ='*'&& str[i+4*J] = ='*') the { +OK =1; A Break; the } + } - if(OK) $ Break; $ } - if(OK) -printf"yes\n"); the ElsePuts"No"); - return 0;Wuyi}View Code
Codeforces 526A King of Thieves enumeration