text stringlengths 49 983k |
|---|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
int n;
cin >> n;
string s;
cin >> s;
vector<int> v;
bool l[10000] = {false};
for (int i = 0; i < n; i++) {
if (s[i] == '*') {
v.push_back(i + 1);
l[i + 1] = true;
}
}
bool flag = false;
if (v.size() < 5) {
cout << "no\n";
return 0;
}
for (int i = 0; i <= v.size() - 4; i++) {
for (int j = 1; j <= n - 4; j++) {
if (l[v[i] + j] && l[v[i] + j * 2] && l[v[i] + j * 3] &&
l[v[i] + j * 4]) {
flag = true;
}
}
}
if (flag) {
cout << "yes\n";
} else {
cout << "no\n";
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
template <class T>
T abs(T x) {
return x > 0 ? x : -x;
}
int n;
int m;
string s;
int main() {
cin >> n >> s;
for (int len = 1; len < n; len++)
for (int i = 0; i < n; i++) {
int cur = 0, j = i;
while (j < n && s[j] == '*') {
cur++;
j += len;
}
if (cur >= 5) {
printf("yes\n");
return 0;
}
}
printf("no\n");
return 0;
}
|
#include <bits/stdc++.h>
int main(void) {
int n;
char level[105];
int aux;
int ok = 0;
scanf(" %d", &n);
scanf(" %s", level);
for (int i = 0; i < n; i++) {
for (int j = 1; j < n; j++) {
aux = 0;
for (int k = i; k < n; k += j) {
if (level[k] == '*') {
aux++;
} else {
break;
}
}
if (aux >= 5) {
ok = 1;
i = n;
break;
}
}
}
if (ok) {
printf("yes\n");
} else {
printf("no\n");
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int nm = 102;
int n;
char s[nm];
int main() {
scanf("%d%s", &n, s);
for (int i = 0; i + 4 < n; ++i) {
for (int j = 1; i + 4 * j < n; ++j)
if (s[i] == '*' && s[i + j] == '*' && s[i + 2 * j] == '*' &&
s[i + 3 * j] == '*' && s[i + 4 * j] == '*') {
printf("yes\n");
return 0;
}
}
printf("no\n");
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
string s;
vector<int> v;
int d = 0, cur = 0, dis, m = 1e5, countm = 0;
cin >> n;
getchar();
cin >> s;
if (s.size() < 2) {
cout << "no" << endl;
return 0;
}
for (int i = 0; i < n; i++) {
if (s[i] == '*') {
v.push_back(i);
}
}
if (v.size() != 0) {
for (int i = 0; i < v.size() - 1; i++) {
dis = v[i + 1] - v[i];
d = max(d, dis);
m = min(m, dis);
}
}
int count = 0;
if (d != 0) {
for (int i = v[0]; i < s.size() - d;) {
if (s[i + d] == '*') {
count++;
i += d;
} else
i++;
if (count > 4) {
break;
}
}
}
if (count < 4 && m != 1e5) {
for (int i = v[0]; i < s.size() - m;) {
if (s[i + m] == '*') {
countm++;
i += m;
} else if (s[i + m] != '*')
break;
if (count > 4) {
break;
}
}
}
if (count >= 4 || countm >= 4) {
cout << "yes" << endl;
} else
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 101;
int N;
char S[MAXN];
bool ar[MAXN];
int main() {
cin >> N >> S;
for (int i = 0; i < N; ++i) {
ar[i] = (S[i] == '*');
}
bool good = false;
for (int i = 0; i < N; ++i) {
if (ar[i]) {
for (int len = 1; len < N; ++len) {
bool found = false;
int cur = i;
for (int k = 0; k < 4; ++k) {
cur += len;
if (cur >= N || !ar[cur]) break;
if (k == 3) found = true;
}
good |= found;
}
}
}
cout << (good ? "yes\n" : "no\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string s;
cin >> s;
vector<int> a;
for (int i = 0; i < n; i++)
if (s[i] == '*') a.push_back(i);
for (int i = a.size() - 1; i >= 0; i--) {
for (int j : a) {
if (j == a[i]) continue;
int d = (a[i] - j) / 4;
if ((a[i] - j) % 4 == 0)
for (int k = 1; k < 4; k++) {
if (s[j + d * k] != '*') break;
if (k == 3 && s[j + d * k] == '*') {
cout << "yes";
return 0;
}
}
}
}
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string s;
cin >> s;
for (int i = 0; i < n; i++) {
if (s[i] == '.') {
continue;
}
for (int j = 1; j < n; j++) {
int cnt = 0;
for (int k = i; k < n; k += j) {
if (s[k] == '*') {
cnt++;
} else
break;
}
if (cnt == 5) {
cout << "yes";
return 0;
}
}
}
cout << "no";
}
|
#include <bits/stdc++.h>
using namespace std;
const int INF = 10000000;
int main() {
int n;
cin >> n;
string a;
cin >> a;
for (int j = 1; j <= 25; j++)
for (int i = 0; i + 4 * j < a.size(); i++) {
if (a[i] == '*' && a[i + j] == '*' && a[i + 2 * j] == '*' &&
a[i + 3 * j] == '*' && a[i + 4 * j] == '*') {
cout << "yes";
return 0;
}
}
cout << "no";
}
|
#include <bits/stdc++.h>
using namespace std;
int CONST = 'z' - 'a' + 1;
struct Node {
Node() {
chars.resize(CONST);
for (int i = 0; i < CONST; i++) chars[i].reset(nullptr);
}
vector<unique_ptr<Node> > chars;
};
int prefix(Node* node, const string& word, int index) {
while (true) {
if (index == word.size()) return word.size();
char c = word[index];
if (node->chars[c - 'a'].get() == nullptr) return index + 1;
node = node->chars[c - 'a'].get();
++index;
}
}
void add(Node* node, const string& word, int index) {
while (true) {
if (index == word.size()) return;
char c = word[index];
if (node->chars[c - 'a'].get() == nullptr)
node->chars[c - 'a'].reset(new Node());
node = node->chars[c - 'a'].get();
index++;
}
}
int main() {
int k;
cin >> k;
string T;
cin >> T;
for (int i = 0; i < T.size(); ++i) {
for (int j = 1; j < T.size(); j++) {
for (int l = i; l <= i + j * 4; l += j) {
if (l < T.size() && T[l] == '*') {
if (l == i + j * 4) {
cout << "yes" << endl;
return 0;
}
} else {
break;
}
}
}
}
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string s;
cin >> s;
bool found = false;
for (int i = 0; i < n && !found; i++)
if (s[i] == '*')
for (int j = i + 1; j < n; j++) {
if (s[j] == '*') {
int dis = j - i;
if (j + 3 * dis < n && s[j + dis] == '*' && s[j + 2 * dis] == '*' &&
s[j + 3 * dis] == '*') {
found = true;
break;
}
}
}
if (found)
cout << "yes" << endl;
else
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int ar[2 * 100005];
long long powmod(long long a, long long b, long long c) {
long long res = 1LL;
while (b > 0) {
if (b & 1) res = (res * a) % c;
a = (a * a) % c;
b /= 2;
}
return res;
}
int main() {
int t, i, j, m, k, n;
string s1;
cin >> n;
int f = 0;
cin >> s1;
for (i = 1; i <= 30; ++i) {
for (j = 0; j < n; ++j) {
int ste = 0;
for (k = 0; k <= 4; ++k) {
if (j + k * i >= n)
break;
else if (s1[j + k * i] == '.')
break;
ste++;
}
if (ste == 5) {
f = 1;
}
}
}
if (f)
cout << "yes\n";
else
cout << "no\n";
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int n, i, j, ans = 0;
char c[101];
scanf("%d", &n);
scanf("%s", c);
int l;
for (l = 1; l <= n; l++) {
for (i = 0; i < n - 4 * l; i++) {
if (c[i] == '*' && c[i + l] == '*' && c[i + 2 * l] == '*' &&
c[i + 3 * l] == '*' && c[i + 4 * l] == '*') {
ans = 1;
break;
}
}
if (ans == 1) break;
}
if (ans == 1)
printf("yes\n");
else
printf("no\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int getInt() {
int x;
scanf("%d", &x);
return x;
}
long long getLongLong() {
long long x;
scanf("%I64d", &x);
return x;
}
double getDouble() {
double x;
scanf("%lf", &x);
return x;
}
char getChar() {
char x;
scanf("%c", &x);
return x;
}
bool response(char s[], int n) {
for (int i = 1; i < n / 4 + 1; i++) {
for (int j = 0; j < n - (i * 4); j++) {
if (s[j] == '*' && s[j + i] == '*' && s[j + i + i] == '*' &&
s[j + i + i + i] == '*' && s[j + (i * 4)] == '*')
return 1;
}
}
return 0;
}
int main() {
int n = getInt();
char s[1000];
gets(s);
gets(s);
if (response(s, n))
printf("yes\n");
else
printf("no\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
int n;
cin >> n;
cin >> s;
int count = 1;
int len = 1;
while (len < n) {
for (int i = 0; i < n; i++) {
int j = i;
while (j + len < n && s[j] == s[j + len] && s[j] == '*') {
j = j + len;
count++;
}
if (count > 4) {
cout << "yes" << endl;
return 0;
}
count = 1;
}
len++;
}
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
scanf("%d", &N);
string ss;
cin >> ss;
int dp[201] = {0};
for (int i = 0; i < N; i++) {
if (ss[i] == '*') {
for (int j = 1; j < N; j++) {
int cnt = 0;
for (int k = i + j; k < N; k += j) {
if (ss[k] == '*')
cnt++;
else
break;
if (cnt >= 4) {
printf("yes\n");
return 0;
}
}
}
}
}
printf("no\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
bool isOkay(string s, int index, int n) {
int i, jump = 1, ans = 0;
for (i = index + jump; i < n; i += jump) {
if (index + jump >= n) break;
if (s[i] == '*') {
ans++;
if (ans == 4) return true;
} else {
jump++;
i = index;
ans = 0;
}
}
return false;
}
int main() {
int n;
cin >> n;
string s;
cin >> s;
vector<int> a;
int i;
for (i = 0; i < n; i++)
if (s[i] == '*') a.push_back(i);
for (i = 0; i < a.size(); i++)
if (isOkay(s, a[i], n)) {
cout << "yes";
return 0;
}
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string s;
cin >> s;
bool f = false;
for (int i = 0; i < n; i++) {
for (int jamp = 1; jamp <= n / 4 && !f; jamp++) {
int j = i;
int cnt = 0;
while (j < n && s[j] == '*' && cnt < 5) {
cnt++;
j += jamp;
}
if (cnt == 5) {
f = true;
}
}
}
if (f) {
cout << "yes";
} else
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string str;
cin >> str;
int arr[101];
int count = 0;
int diff[101];
int i, j, flag, prev, k;
flag = 0;
int length = str.size();
for (i = 0; i < length; i++) {
for (k = 1; k < length; k++) {
for (j = i; j < length; j += k) {
if (str[j] == '*')
count++;
else {
break;
}
}
if (count >= 5) {
flag = 1;
break;
}
count = 0;
}
if (flag == 1) break;
}
if (flag == 1)
cout << "yes\n";
else
cout << "no\n";
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int n, i, j, k, l;
char f, s[102];
scanf("%d", &n);
scanf("%s", s);
f = 0;
for (i = 0; i < 100; i++) {
for (j = 1; j <= 26; j++) {
if (i + 4 * j < n) {
for (k = 0; k <= 4; k++) {
if (s[i + k * j] != '*') {
break;
}
}
if (k == 5) {
f = 1;
}
}
}
}
if (f) {
printf("yes\n");
} else {
printf("no\n");
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
char ch[100100];
int n;
bool judge(int whe1, int whe2) {
bool yess = 1;
yess &= (ch[whe1] == '*');
whe1 += whe2;
yess &= (ch[whe1] == '*');
whe1 += whe2;
yess &= (ch[whe1] == '*');
whe1 += whe2;
yess &= (ch[whe1] == '*');
whe1 += whe2;
yess &= (ch[whe1] == '*');
return yess;
}
int main() {
cin >> n;
scanf("%s", ch + 1);
bool yes = 0;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++)
if (judge(j, i)) {
yes = 1;
break;
}
if (yes) break;
}
if (yes)
printf("yes");
else
printf("no");
}
|
#include <bits/stdc++.h>
using namespace std;
inline int _Int() {
char INPUT[15];
scanf("%s", INPUT);
return atoi(INPUT);
}
long long int bigMod(long long int A, long long int P, int M) {
long long int R = 1;
for (A %= M; P; P >>= 1) {
if (P & 1) R = (R * A) % M;
A = (A * A) % M;
}
return R;
}
long long int bigMul(long long int A, long long int B, long long int M) {
long long int R = 0;
for (A %= M; B; B >>= 1) {
if (B & 1) R = (R + A) % M;
A = (A + A) % M;
}
return R;
}
unsigned long long int _pow(unsigned long long int A, int P) {
unsigned long long int R = 1;
for (; P; P >>= 1) {
if (P & 1) R = (R * A);
A = (A * A);
}
return R;
}
template <class T>
T GCD(T x, T y) {
while (x) x ^= y ^= x ^= y %= x;
return y;
}
char s[300];
void Main() {
int n = _Int();
scanf("%s", s + 1);
for (int d = 1; d <= n; d++) {
for (int i = 1; i <= n; i++) {
if (s[i] == '*') {
int cnt = 0, loop = 0;
for (int j = i; loop < 5; j += d, loop++) {
if (s[j] != '*') break;
}
if (loop == 5) {
printf("yes");
return;
}
}
}
}
printf("no");
}
int main() {
Main();
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int mod1 = int(1e9) + 7;
int main() {
int n;
cin >> n;
string s;
cin >> s;
for (int i = 1; i <= (int)(n); ++i) {
for (int j = 0; j < (int)(n); ++j) {
bool ok = true;
for (int k = 0; k < (int)(5); ++k) {
if (j + i * k > n - 1 || s[j + i * k] == '.') {
ok = false;
break;
}
}
if (ok) {
cout << "yes" << endl;
return 0;
}
}
}
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int mxn = (int)1e5;
int n;
char str[mxn];
int main() {
scanf("%d %s", &n, str);
for (int i = 0; i < n; i++) {
if (str[i] != '*') continue;
for (int j = 1; i + j * 4 < n; j++) {
int f = 1;
for (int k = 1; k < 5; k++) {
if (str[i + k * j] != '*') {
f = 0;
break;
}
}
if (f) {
printf("yes");
return 0;
}
}
}
printf("no");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
string s;
bool found = false;
cin >> n >> s;
vector<bool> platform;
platform.assign(n, false);
for (int i = 0; i < n; i++) {
if (s[i] == '*') platform[i] = true;
}
for (int i = 0; i < n && (!found); i++) {
for (int j = 1; j < n && (!found); j++) {
if (i + (4 * j) < n) {
if (platform[i] && platform[i + j] && platform[i + 2 * j] &&
platform[i + 3 * j] && platform[i + 4 * j]) {
found = true;
break;
}
}
}
}
if (found)
cout << "yes\n";
else
cout << "no\n";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
char s[1000];
int main() {
int n;
cin >> n;
scanf("%s", s + 1);
int flag = 0;
for (int i = 0; i <= n; i++) {
for (int j = 1; j <= 100; j++) {
if (s[i] == '*' && s[i + j] == '*' && s[i + 2 * j] == '*' &&
s[i + 3 * j] == '*' && s[i + 4 * j] == '*') {
cout << "yes" << endl;
return 0;
}
}
}
cout << "no" << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, i, len, k;
bool fl = false;
char s[101];
cin >> n;
cin >> s;
for (len = 1; len < n && !fl; len++) {
for (int j = 0; j < n && !fl; j++) {
for (i = j; s[i] != '*' && i < n; i++)
;
if (i + len * 4 < n)
if (s[i] == '*' && s[i + len] == '*' && s[i + len * 2] == '*' &&
s[i + len * 3] == '*' && s[i + len * 4] == '*')
fl = true;
}
}
if (fl == true)
cout << "yes";
else
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
char s[n];
for (int i = 0; i < n; i++) cin >> s[i];
if (n < 5) {
cout << "no" << endl;
return 0;
}
bool ans = false;
for (int i = 1; i < 26; i++) {
for (int start = 0; start < i; start++) {
int cnt = 0, j = start;
while (j < n) {
if (s[j] == '*')
cnt++;
else {
cnt = 0;
}
if (cnt == 5) ans = true;
j += i;
}
}
}
if (ans)
cout << "yes" << endl;
else
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
class range {
struct Iterator {
int val, inc;
int operator*() { return val; }
bool operator!=(Iterator& rhs) { return val < rhs.val; }
void operator++() { val += inc; }
};
Iterator i, n;
public:
range(int e) : i({0, 1}), n({e, 1}) {}
range(int b, int e) : i({b, 1}), n({e, 1}) {}
range(int b, int e, int inc) : i({b, inc}), n({e, inc}) {}
Iterator& begin() { return i; }
Iterator& end() { return n; }
};
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
inline bool valid(int x, int w) { return 0 <= x && x < w; }
void iostream_init() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.setf(ios::fixed);
cout.precision(12);
}
int main() {
iostream_init();
int n;
while (cin >> n) {
string s;
cin >> s;
bool ok = false;
for (int i = 0; i < (int)(n); ++i) {
for (int d = 1; d < n; d++) {
int cnt = 0;
for (int k = 0; k < (int)(5); ++k) {
int idx = i + d * k;
if (idx < s.size() && s[idx] == '*') cnt++;
}
if (cnt == 5) ok = true;
}
}
cout << (ok ? "yes" : "no") << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const double e = exp(1.0);
const double eps = 1e-8;
const int maxn = 1e5 + 10;
long long arr[maxn];
long long c, hr, hb, wr, wb;
char str[10000000];
int main() {
int n;
while (cin >> n) {
scanf("%s", str);
int ok = 0, okk = 0;
int k;
int ck;
for (int i = 0; i < n && !ok; ++i) {
for (int j = 1; j < n && !ok; ++j) {
for (k = 0; k < 5; ++k) {
ck = i + j * k;
if (ck >= n || str[ck] != '*') break;
}
if (k == 5) ok = 1;
}
}
if (ok == 1)
puts("yes");
else
puts("no");
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, sum = 0, j, k;
char s[11111];
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> s[i];
}
for (int i = 1; i <= n; i++) {
if (s[i] == '*') {
for (k = 1; k <= n / 2; k++) {
for (j = i; j <= n; j = j + k) {
if (s[j] == '*')
sum++;
else {
if (sum > 4)
break;
else
sum = 0;
}
}
if (sum > 4)
break;
else
sum = 0;
}
}
}
if (sum > 4)
cout << "yes";
else
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
struct __timestamper {};
int main(void) {
int n, f = 1;
cin >> n;
string st;
cin >> st;
for (int i = 0; i < n; i++) {
for (int j = 1; j <= 99; j++) {
f = 1;
for (int k = 0; k <= 4; k++) {
f &= (i + k * j < n && st[i + k * j] == '*');
}
if (f) {
cout << "yes" << endl;
return 0;
}
}
}
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100 + 2;
int n;
string s;
void solve() {
bool ok = false;
for (int len = 1; len < (int)s.length(); ++len) {
for (int i = 0; i + len - 1 < (int)s.size(); ++i) {
int cnt = 0;
for (int j = i; j < s.size(); j += len) {
if (s[j] == '.') break;
++cnt;
}
if (cnt >= 5) {
ok = true;
puts("yes");
break;
}
}
if (ok) break;
}
if (!ok) puts("no");
}
int main() {
cin >> n;
cin >> s;
solve();
return 0;
}
|
#include <bits/stdc++.h>
int main(void) {
int n, max_single_jump_length, single_jump_length, all_jump_length,
max_start_position, start_position, finish_position, jump_position;
char map[102] = {0};
scanf("%d", &n);
scanf("%s", map + 1);
max_single_jump_length = (n - 1) / 4;
for (single_jump_length = 1; single_jump_length <= max_single_jump_length;
single_jump_length++) {
all_jump_length = 4 * single_jump_length;
max_start_position = n - all_jump_length;
for (start_position = 1; start_position <= max_start_position;
start_position++) {
finish_position = start_position + all_jump_length;
for (jump_position = start_position; jump_position <= finish_position;
jump_position += single_jump_length) {
if (map[jump_position] == '.') break;
}
if (jump_position > finish_position) {
printf("yes");
return 0;
}
}
}
printf("no");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
const double EPS = 1e-7;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
string s;
cin >> s;
bool ok = false;
for (int l = 1; l <= n; l++) {
for (int start = 0; start + 4 * l < (int)s.length(); start++) {
ok = true;
for (int i = 0; i < 5; i++)
if (s[start + i * l] != '*') {
ok = false;
break;
}
if (ok) break;
}
if (ok) break;
}
if (ok)
cout << "yes" << endl;
else
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n, flag;
char jadval[300];
int main() {
cin >> n;
for (int i = 0; i < n; i++) cin >> jadval[i];
flag = 1;
for (int i = 1; i < n; i++) {
flag = 0;
for (int j = 0; j < n; j++) {
flag = 0;
for (int k = 0; k <= 4; k++)
if (jadval[j + k * i] == '.' || j + k * i >= n) flag = 1;
if (flag == 0) break;
}
if (flag == 0) break;
}
if (flag == 0)
cout << "yes" << endl;
else
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
char s[500];
int main() {
int n;
scanf("%d %s", &n, s);
for (int i = 0; i < n; i++) {
for (int j = 1; j <= 25; j++) {
if (s[i] == '*' && s[i + j] == '*' && s[i + j * 2] == '*' &&
s[i + j * 3] == '*' && s[i + j * 4] == '*') {
printf("yes");
return 0;
}
}
}
printf("no");
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int n, i, count, j, dif;
char ch, level[101];
scanf("%d", &n);
ch = getchar();
gets(level);
for (i = 0; i < n - 4; i++) {
count = 0;
if (level[i] == '*') {
for (j = i + 1; j < n - 3; j++) {
if (level[j] == '*') {
dif = j - i;
if ((i + (4 * dif)) < n) {
if (level[i + 2 * dif] == '*' && level[i + 3 * dif] == '*' &&
level[i + 4 * dif] == '*') {
count = 1;
break;
}
}
}
}
if (count == 1) break;
}
}
if (count == 0)
printf("no");
else
printf("yes");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
template <class T>
T gcd(T a, T b) {
T r;
while (b != 0) {
r = a % b;
a = b;
b = r;
}
return a;
}
template <class T>
T lcm(T a, T b) {
return a / gcd(a, b) * b;
}
template <class T>
int getbit(T s, int i) {
return (s >> i) & 1;
}
template <class T>
T onbit(T s, int i) {
return s | (T(1) << i);
}
template <class T>
T offbit(T s, int i) {
return s & (~(T(1) << i));
}
const double PI = 2 * acos(0.0);
const double eps = 1e-9;
const int infi = 1e9;
const long long Linfi = (long long)1e18;
const long long MOD = 1000000007;
const int c1 = 31;
int n;
string s;
vector<int> V;
void solve() {
for (int i = 1; i <= n; i++)
if (s[i] == '*') V.push_back(i);
if (V.size() >= 5) {
for (int i = 0; i < V.size(); i++)
for (int j = i + 1; j < V.size(); j++)
for (int k = j + 1; k < V.size(); k++)
for (int h = k + 1; h < V.size(); h++)
for (int l = h + 1; l < V.size(); l++) {
int tmp = V[j] - V[i];
if (tmp == V[k] - V[j] && tmp == V[h] - V[k] &&
tmp == V[l] - V[h]) {
cout << "yes" << endl;
return;
}
}
}
cout << "no" << endl;
}
int main() {
ios::sync_with_stdio(false);
cin >> n;
cin >> s;
s = '0' + s;
solve();
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
int main() {
if (fopen("in", "r")) freopen("in", "r", stdin), freopen("out", "w", stdout);
ios_base::sync_with_stdio(0), cin.tie(0);
int n;
cin >> n;
string second;
cin >> second;
bool ans = 0;
for (int i = 0; i < n; ++i) {
for (int j = 1; j < n; ++j) {
if (i + 4 * j < n) {
if (second[i] == '*' && second[i + j] == '*' &&
second[i + 2 * j] == '*' && second[i + 3 * j] == '*' &&
second[i + 4 * j] == '*')
ans = 1;
}
}
}
cout << (ans ? "yes" : "no");
}
|
#include <bits/stdc++.h>
using namespace std;
void _solve() {
int n;
cin >> n;
char arr[120];
vector<int> V;
int maxi;
for (int i = 1; i <= n; i++) {
cin >> arr[i];
if (arr[i] == '*') {
V.push_back(i);
maxi = i;
}
}
int size = V.size();
bool flag = false;
for (int i = 0; i < size; i++) {
for (int j = i + 1; j < size; j++) {
int dif = V[j] - V[i];
int count = 0;
int x = V[j];
while (x + dif <= maxi) {
if (arr[x + dif] != '*') break;
x += dif;
count++;
}
if (count == 3) {
flag = true;
break;
}
}
if (flag) break;
}
if (flag)
cout << "yes" << endl;
else
cout << "no" << endl;
}
int main() {
ios_base::sync_with_stdio(0);
_solve();
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n;
string a;
int main() {
cin >> n >> a;
for (int i = 0; i < n; i++) {
for (int j = 1; j <= n; j++) {
if (i + j * 4 >= n) break;
if (a[i] == '*' && a[i + j] == '*' && a[i + 2 * j] == '*' &&
a[i + 3 * j] == '*' && a[i + 4 * j] == '*') {
cout << "yes";
return 0;
}
}
}
cout << "no";
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
string str;
cin >> n >> str;
bool s[101] = {0};
bool ans = false;
for (int i = 0; i < n; i++) {
if (str[i] == '*') {
for (int j = i + 1; j < n; j++) {
if (str[j] == '*') {
int diff = j - i;
if (j + 3 * diff < n && str[j + diff] == '*' &&
str[j + 2 * diff] == '*' && str[j + 3 * diff] == '*') {
ans = true;
goto DONE;
}
}
}
}
}
DONE:
if (ans)
puts("yes");
else
puts("no");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n, cnt;
char s[111];
void dfs(int id, int d) {
if (id >= n) return;
if (s[id] == '*')
cnt++;
else
return;
dfs(id + d, d);
}
int main() {
scanf("%d\n", &n);
gets(s);
bool fl = 0;
for (int i = 0; i < n; ++i) {
for (int d = 1; d <= n; ++d) {
cnt = 0;
dfs(i, d);
if (cnt >= 5) fl = 1;
}
}
if (fl) {
puts("yes");
} else
puts("no");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n;
string s;
int main() {
ios::sync_with_stdio(0);
cin >> n;
cin >> s;
bool a = 0;
for (int i = 0; i < n; ++i)
for (int len = 1; i + 4 * len < n; ++len) {
bool g = 1;
for (int j = 0; j < 5; ++j)
if (s[i + j * len] == '.') g = 0;
a |= g;
}
if (a)
puts("yes");
else
puts("no");
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
char data[200];
int val;
bool est = false;
cin >> val;
for (int i = 0; i < val; i++) cin >> data[i];
for (int i = 1; i < val; i++)
for (int j = 0; j < val; j++) {
int cont = 0;
for (int k = 0; k < val; k += i) {
if (data[j + k] == '*')
cont++;
else
cont = 0;
if (cont >= 5) est = true;
}
}
cout << (est ? "yes" : "no") << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
struct custom_hash {
static uint64_t splitmix64(uint64_t x) {
x += 0x9e3779b97f4a7c15;
x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
return x ^ (x >> 31);
}
size_t operator()(uint64_t x) const {
static const uint64_t FIXED_RANDOM =
chrono::steady_clock::now().time_since_epoch().count();
return splitmix64(x + FIXED_RANDOM);
}
};
const int SZ = 5e3 + 4;
const int inf = 2e9;
int n;
string s;
inline void read() { cin >> n >> s; }
inline void solve() {
for (int i = 0; i < n; ++i) {
for (int j = 1; i + 4 * j < n; ++j) {
bool z = true;
for (int k = 0; k <= 4; ++k) {
z &= s[i + k * j] == '*';
}
if (z) {
cout << "yes\n";
return;
}
}
}
cout << "no\n";
}
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
read();
solve();
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
bool plat[1000];
int main() {
int n;
string s;
cin >> n >> s;
for (int i = 0; i < n; ++i) {
plat[i] = s[i] == '*';
}
for (int i = 0; i < n; ++i) {
if (!plat[i]) continue;
for (int j = i + 1; j < n; ++j) {
if (!plat[j]) continue;
int d = j - i;
if (plat[j + d] && plat[j + 2 * d] && plat[j + 3 * d]) {
cout << "yes\n";
return 0;
}
}
}
cout << "no\n";
return 0;
}
|
#include <bits/stdc++.h>
int main() {
char a[200];
int n;
bool plat[200];
scanf("%d", &n);
scanf("%s", a);
for (int i = 0; i < n; i++) {
if (a[i] == '*')
plat[i] = true;
else
plat[i] = false;
}
bool ans = false;
for (int i = 0; i < n; i++) {
if (!plat[i]) continue;
for (int m = 1; i + m * 4 < n; m++) {
if (plat[i + m] && plat[i + 2 * m] && plat[i + 3 * m] &&
plat[i + 4 * m]) {
ans = true;
break;
}
}
}
printf("%s", ans ? "yes\n" : "no\n");
}
|
#include <bits/stdc++.h>
using namespace std;
int i, j, qan, n, m, k, l, p;
bool mark[102];
char s;
int main() {
cin >> n;
for (i = 1; i <= n; i++) {
cin >> s;
if (s == '*') {
mark[i] = true;
}
}
qan = (n - 5) / 4;
for (i = 0; i <= qan; i++) {
for (j = 1; j <= n - 4 - 4 * i; j++) {
if (mark[j] == true && mark[j + i + 1] == true &&
mark[j + 2 * i + 2] == true && mark[j + 3 * i + 3] == true &&
mark[4 * i + j + 4] == true) {
cout << "yes" << endl;
return 0;
}
}
}
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int l;
cin >> l;
string s;
cin >> s;
int count = 1;
for (int j = 0; j < l; j++) {
for (int i = 0; i < l; i++) {
if ((count * 4) - 1 > l) break;
if (s[i] == '*' && s[i] == s[i + count] &&
s[i + count] == s[i + count * 2] &&
s[i + count * 2] == s[i + count * 3] &&
s[i + count * 3] == s[i + count * 4]) {
cout << "yes" << endl;
return 0;
}
}
count++;
}
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n, k, countt;
string s;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cin >> n >> s;
for (int i = 1; i < n; ++i) {
for (int k = 0; k < n; k++) {
for (int j = k; j < n; j += i) {
if (s[j] == '*')
countt++;
else {
countt = 0;
break;
}
if (countt >= 5) {
cout << "yes";
return 0;
}
}
countt = 0;
}
}
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int oo = 1 << 30;
const double PI = M_PI;
const double EPS = 1e-15;
int n;
string s;
int main() {
cin.sync_with_stdio(false);
cin >> n;
cin >> s;
bool ok = false;
for (int i = 0; i < n; i++) {
if (s[i] != '*') continue;
for (int j = i + 1; j < n; j++)
if (s[j] == '*') {
int d = j - i;
if (j + d * 1 < n && s[j + d * 1] == '*')
if (j + d * 2 < n && s[j + d * 2] == '*')
if (j + d * 3 < n && s[j + d * 3] == '*') ok = true;
}
}
cout << (ok ? "yes" : "no") << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
bool vis[101];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(nullptr);
long long int n;
cin >> n;
string s;
cin >> s;
for (int i = 0; i < n; i++) {
if (s[i] == '.')
vis[i] = 0;
else
vis[i] = 1;
}
int f = 0;
for (int i = 1; i < 26; i++) {
int ff = 1;
for (int j = 0; j < n; j++) {
ff = 1;
if ((j + 4 * i) >= n) {
ff = 0;
break;
}
if (vis[j] == 0) ff = 0;
if (vis[j + i] == 0) ff = 0;
if (vis[j + i + i] == 0) ff = 0;
if (vis[j + i + i + i] == 0) ff = 0;
if (vis[j + i + i + i + i] == 0) ff = 0;
if (ff == 1) {
f = 1;
break;
}
}
if (ff == 1) {
f = 1;
break;
}
}
if (f)
cout << "yes";
else
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int inf = INT_MAX;
const long long inf_ll = 0x7f7f7f7f;
const double eps = 1e-8;
const int bfs_dy[] = {-1, -1, -1, 0, 0, 1, 1, 1};
const int bfs_dx[] = {-1, 0, 1, -1, 1, -1, 0, 1};
const int dfs_dy[] = {0, 1, 0, -1};
const int dfs_dx[] = {1, 0, -1, 0};
pair<int, int> dir[] = {make_pair(0, 1), make_pair(1, 0), make_pair(0, -1),
make_pair(-1, 0)};
int main() {
int n;
cin >> n;
string a;
cin >> a;
for (int i = 0; i < n; i++) {
if (a[i] == '*') {
for (int j = i + 1; j < n; j++) {
if (a[j] == '*') {
int step = j - i;
int cnt = 2;
for (int k = j + step; k < n; k += step) {
if (a[k] == '*') {
cnt++;
} else {
break;
}
if (cnt == 5) {
cout << "yes" << endl;
return 0;
}
}
}
}
}
}
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
char a[1000];
int main() {
int n;
scanf("%d", &n);
scanf("%s", a);
int flag = 0;
for (int i = 0; i < n; i++) {
for (int j = 1; j <= 100; j++) {
if (a[i] == '*' && a[i + j] == '*' && a[i + 2 * j] == '*' &&
a[i + 3 * j] == '*' && a[i + 4 * j] == '*') {
flag = 1;
break;
}
}
}
if (flag == 1)
printf("yes\n");
else
printf("no\n");
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int cnt, d, i, j, k, n, m;
string s;
cin >> n >> s;
cnt = 0;
for (i = 0; i <= n - 5; i++) {
if (s[i] == '*') {
cnt = 0;
d = (n - i - 1) / 4;
for (; d >= 1; d--) {
cnt = 0;
for (j = i; j < n; j += d) {
if (cnt == 5)
break;
else if (s[j] == '.')
cnt = 0;
else if (s[j] == '*')
cnt++;
}
if (cnt == 5) {
break;
}
}
}
if (cnt == 5) break;
}
if (cnt == 5)
printf("yes\n");
else
printf("no\n");
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int n;
char s[110];
scanf("%d", &n);
scanf("%s", s + 1);
for (int i = 1; i <= n; i++) {
if (s[i] != '*') continue;
for (int j = 1; j <= n; j++) {
int k;
for (k = 1; k <= 4; k++) {
if (s[i + k * j] != '*') break;
}
if (k > 4) {
printf("yes\n");
return 0;
}
}
}
printf("no\n");
}
|
#include <bits/stdc++.h>
using namespace std;
inline void __CIN__() {
ios::sync_with_stdio(false);
cin.tie(0);
}
char buf;
inline int xint() {
while (buf = getchar(), buf < '0' || buf > '9')
;
int x = buf - '0';
for (; buf = getchar(), buf >= '0' && buf <= '9'; x = x * 10 + buf - '0')
;
return x;
}
inline long long xll() {
while (buf = getchar(), buf < '0' || buf > '9')
;
long long x = buf - '0';
for (; buf = getchar(), buf >= '0' && buf <= '9'; x = x * 10 + buf - '0')
;
return x;
}
inline string xstring() {
while (buf = getchar(), buf == ' ' || buf == '\n')
;
string x = "";
for (x += buf; buf = getchar(), buf != ' ' && buf != '\n'; x += buf)
;
return x;
}
const long long MOD = 1000000009;
long long powmod(long long a, long long b) {
long long res = 1;
a %= MOD;
for (; b; b >>= 1) {
if (b & 1) res = res * a % MOD;
a = a * a % MOD;
}
return res;
}
int main() {
int l, data[105], i, j, k, n;
string s;
cin >> n;
cin >> s;
for (i = 0; i < n - 4; ++i)
if (s[i] == '*') {
for (j = 1;; ++j) {
if (4 * j + i >= n) break;
if (s[i + j] == '*' && s[i + 2 * j] == '*' && s[i + 3 * j] == '*' &&
s[i + 4 * j] == '*') {
cout << "yes" << endl;
exit(0);
}
}
}
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
bool *f = new bool[n];
char ch;
for (int i = 0; i < n; ++i) {
cin >> ch;
f[i] = (ch == '*');
}
int count;
for (int d = 1; d <= n / 4; ++d) {
for (int start = 0; start < d; ++start) {
count = 0;
for (int i = start; i < n; i += d) {
if (f[i]) {
count++;
if (count == 5) {
cout << "yes" << endl;
return 0;
}
} else {
count = 0;
}
}
}
}
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, f = 0, i, j;
cin >> n;
char a[n];
for (i = 0; i < n; i++) cin >> a[i];
for (i = 1; i <= 25; i++) {
for (j = 0; j < n; j++) {
if ((a[j] == '*') && ((a[j + i] == '*') && (j + i < n)) &&
((a[j + 2 * i] == '*') && (j + 2 * i < n)) &&
((a[j + 3 * i] == '*') && (j + 3 * i < n)) &&
((a[j + 4 * i] == '*') && (j + 4 * i < n))) {
f = 1;
break;
}
}
if (f == 1) break;
}
if (f == 1)
cout << "yes" << endl;
else
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, cnt, f = 0;
string plat;
cin >> n;
cin >> plat;
for (int i = 1; i <= n; i++) {
for (int j = 0; j < n; j++) {
cnt = 0;
if (plat[j] == '*') {
for (int k = j; k <= n; k += i) {
if (plat[k] == '*')
cnt++;
else
break;
}
if (cnt == 5) {
cout << "yes" << endl;
return 0;
}
}
}
}
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int LIS(vector<int> A) {
int N = A.size(), i;
multiset<int> s;
multiset<int>::iterator k;
for (i = 0; i < N; i++) {
s.insert(A[i]);
if (1) {
k = s.find(A[i]);
k++;
if (k != s.end()) s.erase(k);
}
}
return s.size();
}
int main() {
int n;
cin >> n;
string s;
cin >> s;
for (int i = 1; i < n; i++) {
for (int j = 0; j + 4 * i < n; j++) {
if (s[j] != '*') continue;
if (s[j + i] == s[j] && s[j + 2 * i] == s[j] && s[j + 3 * i] == s[j] &&
s[j + 4 * i] == s[j]) {
cout << "yes";
return 0;
}
}
}
cout << "no";
}
|
#include <bits/stdc++.h>
using namespace std;
int n, k, a, b, x, y, i = 1, j, l;
string s;
int main() {
cin >> n >> s;
while (i <= n / 4) {
while (j < n) {
l = j;
while (l < n) {
if (s[l] == '*') {
x++;
if (x == 5) {
cout << "yes";
return 0;
}
} else {
x = 0;
}
l += i;
}
l = 0;
j++;
x = 0;
}
i++;
j = 0;
}
cout << "no";
}
|
#include <bits/stdc++.h>
using namespace std;
int F(const void* l, const void* r) { return (*(int*)l - *(int*)r); }
const long long inf = 10000000007;
int n;
char s[1000];
int main() {
ios::ios_base::sync_with_stdio(false);
cin >> n;
int k;
for (long long i = 1; i <= 700; i++) s[i] = '.';
for (long long i = 1; i <= n; i++) cin >> s[i];
for (long long i = 1; i <= n; i++) {
if (s[i] == '*') {
for (long long j = 1; j <= n; j++) {
if (s[i + j] == '*' && s[i + 2 * j] == '*' && s[i + 3 * j] == '*' &&
s[i + 4 * j] == '*') {
cout << "yes" << endl;
return 0;
};
}
}
}
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string s;
cin >> s;
int res = 0;
for (int i = 0; i < n && !res; i++) {
if (s[i] == '.') continue;
for (int j = 1; j < n && !res; j++) {
int d = 0;
for (int k = 1; k < 5 && i + j * k < n; k++) {
if (s[i + j * k] == '*')
d++;
else
break;
}
if (d == 4) res = 1;
}
}
if (res)
cout << "yes" << endl;
else
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string s;
cin >> s;
int ok = 0;
for (int len = 1; len <= n; ++len) {
vector<int> v(n);
for (int i = 0; i < (int)n; ++i)
if (s[i] == '*')
v[i] = 1 + (i >= len ? v[i - len] : 0);
else
v[i] = 0;
if (*max_element(v.begin(), v.end()) >= 5) ok = 1;
}
if (ok)
cout << "Yes" << endl;
else
cout << "No" << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
const int N = 100 * 1000 + 10;
int n;
string s;
int main() {
cin >> n;
cin >> s;
for (int i = 0; i < n; ++i) {
for (int j = 1; i + 4 * j < n; ++j) {
bool f = 1;
int t = 0;
for (int k = i; k < n; k += j) {
t++;
if (t > 5) break;
if (s[k] == '.') f = 0;
}
if (f) {
cout << "yes\n";
return 0;
}
}
}
cout << "no\n";
return 0;
}
|
#include <bits/stdc++.h>
int main() {
std::ios::sync_with_stdio(false);
int n;
std::string level;
std::cin >> n;
std::cin >> level;
bool hole_jump = false;
for (int i = 0; i < n && !hole_jump; i++) {
if ('.' == level[i]) {
continue;
}
const size_t next_space_index = level.find('.', i + 1);
if (std::string::npos == next_space_index) {
continue;
}
const size_t next_platform_index = level.find('*', next_space_index + 1);
if (std::string::npos == next_platform_index) {
break;
}
for (int p = next_platform_index; p < n && !hole_jump; p++) {
if ('.' == level[p]) {
continue;
}
int jump_counter = 0;
const size_t step = p - i;
for (int j = i; j < n; j += step) {
if (level[j] == '*') {
jump_counter++;
} else {
break;
}
if (jump_counter > 4) {
hole_jump = true;
break;
}
}
}
}
done:
bool full_level = level.find("*****") != std::string::npos;
if (hole_jump || full_level) {
std::cout << "yes" << std::endl;
} else {
std::cout << "no" << std::endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
string str;
cin >> n;
cin.get();
cin >> str;
for (int i = 0; i < n; ++i) {
if (str[i] != '*') continue;
for (int j = 1; j < 30; ++j) {
int nj = 0;
int cur = i;
while (nj < 4 && cur < n && cur + j < n && str[cur + j] != '.') {
cur += j;
++nj;
}
if (nj == 4) {
cout << "yes" << endl;
return 0;
}
}
}
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int n, i, j, flag = 0;
char b[130];
scanf("%d", &n);
scanf("%s", b);
for (i = 0; i < n; i++) {
for (j = 1; j < n; j++) {
if (b[i] == '*' && b[i + j] == '*' && b[i + 2 * j] == '*' &&
b[i + 3 * j] == '*' && b[i + 4 * j] == '*') {
flag = 1;
break;
}
}
if (flag) break;
}
if (flag)
printf("yes");
else
printf("no");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int len;
string level;
bool check(int start, int step) {
for (int i = 0; i < 5; i++) {
if (start + step * i >= level.size() || level[start + step * i] == '.')
return 0;
}
return 1;
}
int main() {
bool found;
while (cin >> len >> level) {
found = 0;
for (int i = 1; i <= level.size(); ++i) {
for (int j = 0; j < level.size(); ++j) {
if (check(j, i)) {
cout << "yes" << '\n';
found = 1;
break;
}
}
if (found) break;
}
if (!found) cout << "no" << '\n';
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string h;
cin >> h;
for (int i = 1; i < n; i++)
for (int j = 0; j < n; j++) {
if (j + 4 * i < n) {
if ((h[j] == '*') && (h[j + i] == '*') && (h[j + 2 * i] == '*') &&
(h[j + 3 * i] == '*') && (h[j + 4 * i] == '*')) {
cout << "yes" << endl;
return 0;
}
}
}
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
string str;
cin >> n >> str;
for (int i = 1; i <= n; ++i) {
for (int k = 0; k < n; ++k)
for (int j = k, c = 0; j < n; j += i) {
if (str[j] == '.') break;
++c;
if (c == 5) {
cout << "yes";
return 0;
}
}
}
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n;
string s;
bool res;
int main() {
cin >> n;
cin >> s;
for (int i = 0; i < n && !res; i++)
if (s[i] == '*')
for (int j = 1; j <= n && !res; j++) {
bool ok = true;
for (int l = 1; l <= 4 && ok; l++)
ok = i + j * l < n && s[i + j * l] == '*';
res = ok;
}
printf("%s\n", res ? "yes" : "no");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
string s;
int n;
int main() {
cin >> n >> s;
for (int i = 0; i < n; i++)
for (int j = i + 1; j < n; j++) {
if (s[i] == '*' && s[j] == '*' && (j - i) % 4 == 0) {
int p = (j - i) / 4, flag = 1;
for (int k = 1; k <= 3; k++)
if (s[i + k * p] == '.') {
flag = 0;
break;
}
if (flag) {
cout << "yes" << endl;
return 0;
}
}
}
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long power(int x, int y) {
if (y == 0)
return 1;
else if (y & 1)
return x * power(x, y / 2) * power(x, y / 2);
else
return power(x, y / 2) * power(x, y / 2);
}
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int main() {
int n;
string s;
cin >> n >> s;
for (int i = 0; i < n; i++) {
for (int j = 1; i + 4 * j < n; j++) {
if (s[i] == '*' && s[i + j] == '*' && s[i + 2 * j] == '*' &&
s[i + 3 * j] == '*' && s[i + 4 * j] == '*') {
cout << "yes" << endl;
return 0;
}
}
}
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n;
string s;
int main() {
cin >> n;
cin >> s;
for (int i = 0; i < n; i++) {
if (s[i] == '.') continue;
for (int j = i + 1; j < n; j++) {
if (s[j] == '.') continue;
int k = j - i;
bool si = true;
for (int p = 0; p < 3; p++) {
si = si && (j + k + k * p < n) && s[j + k + k * p] == '*';
}
if (si) {
cout << "yes" << endl;
return 0;
}
}
}
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
const unsigned long long inf = 1LL << 61;
const double eps = 1e-5;
using namespace std;
bool cmp(int a, int b) { return a > b; }
int main() {
int n;
string s;
while (cin >> n) {
cin >> s;
for (int i = 1; i <= 510; i++) s += ".";
for (int len = 1; len <= n; len++) {
for (int i = 0; i < n; i++) {
if (s[i] == '*' && s[i + len] == '*' && s[i + 2 * len] == '*' &&
s[i + 3 * len] == '*' && s[i + 4 * len] == '*') {
puts("yes");
return 0;
}
}
}
puts("no");
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int maxn = 110;
char tmp[maxn];
int dp[maxn][maxn];
int N;
int main() {
scanf("%d", &N);
scanf("%s", tmp);
bool flag = false;
memset(dp, 0, sizeof(dp));
for (int i = 1; i < N; i++) {
if (tmp[i] == '.') continue;
for (int j = 0; j < i; j++) {
if (tmp[j] == '.') continue;
dp[i][i - j] = max(dp[i][i - j], dp[j][i - j] + 1);
if (dp[i][i - j] >= 4) flag = true;
}
}
if (flag)
puts("yes");
else
puts("no");
}
|
#include <bits/stdc++.h>
int n, ok;
char s[10010];
int main() {
scanf("%d%s", &n, s);
for (int i = 0; i < n; i++) {
for (int level = 1; level <= n; level++) {
for (int j = 0; j < 5; j++) {
if (i + level * j >= n) break;
if (s[i + level * j] != '*') break;
if (j == 4) ok = true;
}
}
}
if (ok)
printf("yes\n");
else
printf("no\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, i, a, b, c, d, x = 0;
string str;
cin >> n;
cin >> str;
n = str.size();
for (i = 0; i < n; i++) {
a = 1;
while (i + a + a + a + a < n) {
if (str[i] == '*' && str[i + a] == '*' && str[i + a + a] == '*' &&
str[i + a + a + a] == '*' && str[i + a + a + a + a] == '*') {
x = 1;
break;
}
a++;
}
if (x == 1) break;
}
if (x == 1)
cout << "YES";
else
cout << "NO";
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string s;
cin >> s;
bool OKAY = false;
for (int start = 0; start < n; ++start) {
for (int len = 1; len < n; ++len) {
bool ok = true;
for (int i = 0; i < 5; ++i) {
if (start + len * i >= n || s[start + len * i] == '.') ok = false;
}
OKAY |= ok;
}
}
cout << (OKAY ? "yes" : "no");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int M = 1e5;
const int Q = 1e9 + 7;
int main() {
srand(time(NULL));
int n;
char s[200];
scanf("%d", &n);
scanf("%s", s);
for (int i = 0; i < n; i++) {
for (int j = 1; j < n; j++) {
int tq, k = i;
for (tq = 0; tq < 5; tq++) {
if (k >= n || s[k] == '.') break;
k += j;
}
if (tq == 5) {
cout << "yes" << endl;
return 0;
}
}
}
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
string ch;
int n;
cin >> n;
cin >> ch;
for (int i = 0; i <= n; i++) {
if (ch[i] == '*') {
for (int j = 1; j <= n / 4; j++)
if ((i + 4 * j) < n)
if ((ch[j + i] == '*') && (ch[i + 2 * j] == '*') &&
(ch[i + 3 * j] == '*') && (ch[i + 4 * j] == '*')) {
cout << "yes";
return 0;
}
}
}
cout << "no";
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
string s;
while (cin >> n >> s) {
bool f = 0;
for (int i = 0; i < s.size(); i++) {
if (s[i] == '.') continue;
for (int j = 1; j <= 100; j++) {
bool ff = 0;
int cnt = 0;
for (int st = i; st < s.size(); st += j) {
if (s[st] == '.') {
ff = 1;
break;
} else
cnt++;
if (cnt == 5) break;
}
if (!ff && cnt == 5) {
cout << "yes\n";
return 0;
}
}
}
cout << "no\n";
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, f = 0, i, j, k, cnt = 0;
string a;
cin >> n;
cin >> a;
for (i = 0; i < n; i++) {
if (a[i] == '*') {
for (j = 1; j < n; j++) {
for (k = i, cnt = 0; k < n;) {
if (a[k] == '*') {
cnt++;
k += j;
} else
break;
if (cnt == 5) {
f = 1;
break;
}
}
if (f) break;
}
}
if (f) break;
}
if (f)
cout << "yes" << endl;
else
cout << "no" << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n;
cin >> n;
string s;
cin >> s;
for (long long i = 0; i < s.size(); i++) {
if (s[i] == '*' && i + 4 <= s.size()) {
for (long long j = 1; j < s.size(); j++) {
if (i + 4 * j <= s.size()) {
if (s[i] == '*' && s[i + j] == '*' && s[i + 2 * j] == '*' &&
s[i + 3 * j] == '*' && s[i + 4 * j] == '*') {
cout << "yes";
return 0;
}
}
}
}
}
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
int good(char *s, int n, int l, int i) {
int x;
for (x = i; x <= i + (l * 4); x += l)
if (x >= n || s[x] != '*') return 0;
return 1;
}
int main() {
static char s[100 + 1];
int n, i, l;
scanf("%d%s", &n, s);
for (l = 1; l < n; l++)
for (i = 0; i < n; i++)
if (good(s, n, l, i)) {
printf("yes\n");
return 0;
}
printf("no\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
char s[3000];
cin >> s + 1;
for (int i = 1; i <= n; i++) {
for (int j = 1; j + 4 * i <= n; j++) {
if (s[j] == '*') {
if (s[j] == '*' && s[i + j] == '*' && (s[j + 2 * i] == '*') &&
(s[j + 3 * i] == '*') && (s[j + 4 * i] == '*')) {
cout << "yes";
return 0;
}
}
}
}
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long EPS = 1000000007;
long double PI = 3.14159265358979323846;
const int MAXN = 1000010;
long long abss(long long h) { return max(h, -h); }
long double fabss(long double h) { return max(h, -h); }
long long ceill(long long x, long long y) {
if (x % y != 0) {
return (x / y) + 1;
}
return x / y;
}
string itos(long long num) {
string str = "";
if (num == 0) {
return "0";
}
while (num != 0) {
str += ((num % 10) + '0');
num /= (long long)10;
}
reverse(str.begin(), str.end());
return str;
}
long long n, m, k, r, t;
int a[MAXN];
long long b[10][10];
vector<int> p[MAXN];
map<int, int> ma;
string need[MAXN];
int main() {
int n;
cin >> n;
string str;
cin >> str;
for (int i = 0; i < str.size(); i++) {
for (int j = 1; j < str.size(); j++) {
int count = 0;
int index = i;
while (index < str.size()) {
if (str[index] == '*') {
count++;
index += j;
} else {
break;
}
}
if (count >= 5) {
cout << "yes";
return 0;
}
}
}
cout << "no";
}
|
#include <bits/stdc++.h>
using namespace std;
int n, ans = 0;
char st[105];
int main() {
int i, j;
scanf("%d\n", &n);
scanf("%s", st + 1);
for (i = 1; i <= n / 4; i++)
for (j = 1; j <= n - 4 * i; j++)
if (st[j] == '*' && st[j + i] == '*' && st[j + 2 * i] == '*' &&
st[j + 3 * i] == '*' && st[j + 4 * i] == '*')
ans = 1;
if (ans)
printf("yes");
else
printf("no");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n, d[128][128][8];
string s;
int main() {
ios::sync_with_stdio(0);
cin >> n >> s;
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
for (int k = 0; k <= 4; k++) {
if (s[i - 1] == '.') continue;
if (!k) {
d[i][j][k] = 1;
continue;
}
if (i >= j) d[i][j][k] |= d[i - j][j][k - 1];
if (k == 4 && d[i][j][k]) {
cout << "yes" << endl;
return 0;
}
}
cout << "no" << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int len;
string second;
cin >> len >> second;
for (int i = 0; i < len; i++) {
for (int l = 1; l < len; l++) {
bool test = 1;
if (4 * l + i >= len) continue;
for (int j = 0; j < 5; j++) {
if (second[j * l + i] != '*') test = 0;
}
if (test) {
cout << "yes" << endl;
return 0;
}
}
}
cout << "no" << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
const int M = 1010;
const double pi = acos(-1.0);
int a[1010];
char str[1010];
bool judge(int len, int j, int m) {
int i, cnt = 1;
for (i = j + 1; i < m; ++i) {
if (a[i] - a[j] == len) {
++cnt;
if (cnt == 4) return true;
j = i;
}
}
return false;
}
int main() {
int i, j, n, m;
scanf("%d", &n);
scanf("%s", str);
m = 0;
for (int i = 0; i < n; i++) {
if (str[i] == '*') {
a[m++] = i;
}
}
for (i = 0; i < m; ++i) {
for (j = i + 1; j < m; ++j) {
if (judge(a[j] - a[i], j, m)) {
printf("yes\n");
return 0;
}
}
}
printf("no\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
string s;
long long n, i, m, t, p, x, a, b, c, d, j, p1, w, f1, z, o, d2, d3, d4, d5;
int main() {
cin >> n;
cin >> s;
for (i = 0; i < n; i++) {
if (s[i] == '*') {
d = i;
for (j = 1; j <= n; j++) {
d2 = d + j;
d3 = d2 + j;
d4 = d3 + j;
d5 = d4 + j;
if (d5 <= n && s[d2] == '*' && s[d3] == '*' && s[d4] == '*' &&
s[d5] == '*') {
cout << "yes";
return 0;
}
}
}
}
cout << "no";
}
|
#include <bits/stdc++.h>
double const EPS = 3e-8;
using namespace std;
template <class T>
T gcd(T a, T b) {
return (b != 0 ? gcd<T>(b, a % b) : a);
}
template <class T>
T lcm(T a, T b) {
return (a / gcd<T>(a, b) * b);
}
template <class T>
inline bool read(T &x) {
int c = getchar();
int sgn = 1;
while (~c && c < '0' || c > '9') {
if (c == '-') sgn = -1;
c = getchar();
}
for (x = 0; ~c && '0' <= c && c <= '9'; c = getchar()) x = x * 10 + c - '0';
x *= sgn;
return ~c;
}
string inp;
int main() {
int n = ({
int a;
read(a);
a;
});
cin >> inp;
int i, sz = n, j;
bool ok = 1;
for (i = sz - 1; i >= 3 && ok; i--) {
if (inp[i] == '.') continue;
for (j = 1; j <= 100 && ok; j++) {
int now = i;
int cnt = 0;
while (1) {
now -= j;
if (now < 0) break;
if (inp[now] == '.') break;
cnt++;
if (cnt >= 4) {
ok = 0;
break;
}
}
}
}
puts(ok ? "no" : "yes");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string inp;
cin >> inp;
string a;
for (int i = 0; i < inp.size(); ++i) {
if (inp[i] == '*') {
for (int length = 1; length <= inp.size(); ++length) {
int k = 0;
for (int j = i + length; j < inp.size(); j += length) {
if (inp[j] != '*')
break;
else
k++;
}
if (k >= 4) {
a = "yes";
goto end;
}
}
}
}
a = "no";
end:;
cout << a << '\n';
}
|
#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const double eps = 1e-8;
int main() {
string s;
int n;
while (~scanf("%d", &n)) {
cin >> s;
int len = s.size();
vector<int> vec;
int a[1000], idx = 0;
for (int i = 0; i < len; i++) {
if (s[i] == '*') {
vec.push_back(i + 1);
a[idx++] = i + 1;
}
}
bool flag = 0;
for (int i = 0; i < vec.size(); i++) {
int t = vec[i];
for (int j = 1; j <= 25; j++) {
bool ans = 0;
for (int k = 0; k <= 4; k++) {
if (vec[i] + k * j <= len && s[vec[i] + k * j - 1] != '*')
ans = 1;
else if (vec[i] + k * j > len)
ans = 1;
}
if (ans == 0) {
flag = 1;
break;
}
}
if (flag) break;
}
if (flag)
printf("yes\n");
else
printf("no\n");
}
return 0;
}
|
#include <bits/stdc++.h>
#pragma comment(linker, "/stack:227420978")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const long long Mod = 1000000007LL, INF = 1e9, LINF = 1e18;
const long double PI = 3.141592653589793116, EPS = 1e-9,
GOLD = ((1 + sqrt(5)) / 2);
long long keymod[] = {1000000007LL, 1000000009LL, 1000000021LL, 1000000033LL};
vector<long long> HashMod(keymod, keymod + sizeof(keymod) / sizeof(long long));
template <class T>
int getbit(T s, int i) {
return (s >> i) & 1;
}
template <class T>
T onbit(T s, int i) {
return s | (T(1) << i);
}
template <class T>
T offbit(T s, int i) {
return s & (~(T(1) << i));
}
template <class T>
int cntbit(T s) {
return __builtin_popcount(s);
}
auto TimeStart = chrono::steady_clock::now();
auto TimeEnd = chrono::steady_clock::now();
void ControlIO(int argc, char* argv[]);
void TimerStart();
void TimerStop();
void Exit();
long long n;
string s;
void Input() { cin >> n >> s; }
void Solve() {
for (long long i = 0; i < n; i++) {
for (long long j = 1; i + 4 * j < n; j++) {
if (s[i] == '*' && s[i + j] == '*' && s[i + 2 * j] == '*' &&
s[i + 3 * j] == '*' && s[i + 4 * j] == '*') {
cout << "yes";
return;
}
}
}
cout << "no";
}
int main(int argc, char* argv[]) {
ios_base::sync_with_stdio(0);
cin.tie(NULL);
ControlIO(argc, argv);
Input();
TimerStart();
Solve();
TimerStop();
return 0;
}
void ControlIO(int argc, char* argv[]) {}
void TimerStart() {}
void TimerStop() {}
void Exit() {
TimerStop();
exit(0);
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.