text stringlengths 49 983k |
|---|
#include <bits/stdc++.h>
using namespace std;
int n, k;
string s;
int main() {
cin >> n >> s;
for (int st = 0; st < n; st++)
for (int step = 1; st + 4 * step < n; step++) {
if (s[st] == '*' && s[st + step] == '*' && s[st + 2 * step] == '*' &&
s[st + 3 * step] == '*' && s[st + 4 * step] == '*') {
cout << "yes";
return 0;
}
}
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int i, j, d, n, c = 0, flag = 0, k;
cin >> n;
char s[n];
cin >> s;
for (i = 0; i < n; i++) {
if (s[i] == '*') {
for (j = i + 1; j < n; j++) {
if (s[j] == '*') {
d = j - i;
c = 0;
k = j + d;
while (k < n && c < 3) {
if (s[k] == '*') {
c++;
k = k + d;
} else
break;
}
if (c == 3) {
flag = 1;
break;
}
}
}
if (flag == 1) break;
}
}
if (flag == 1)
cout << "yes" << endl;
else
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
bool a[110];
char s[110];
int main() {
int n, j, i, k;
memset(a, 0, sizeof(a));
scanf("%d%s", &n, s);
for (i = 0; i < n; i++)
if (s[i] == '*') a[i] = true;
for (i = 0; i < n; i++) {
for (j = 1; j < n; j++) {
int cnt = 0;
for (k = i; k < n; k += j)
if (!a[k])
break;
else
cnt++;
if (cnt >= 5) {
printf("yes\n");
return 0;
}
}
}
printf("no\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
template <typename T>
T absll(T X) {
if (X < 0)
return -1 * X;
else
return X;
}
int main() {
int N;
cin >> N;
string str;
cin >> str;
int maxsteps = -1;
int steps = 0;
vector<int> V(10000, 0);
vector<int> A;
for (int i = 0; i < N; i++) {
if (str[i] == '*') {
V[i + 1] = 1;
A.push_back(i + 1);
}
}
bool flag = 1;
for (int i = 0; i < A.size(); i++) {
for (int j = 1; j <= 100; j++) {
flag = 1;
for (int k = 1; k < 5; k++) {
if (V[A[i] + k * j] == 0) {
flag = 0;
break;
}
}
if (flag) {
cout << "yes\n";
return 0;
}
}
}
printf("no\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const int N = 300010;
int n;
string s;
int main() {
cin >> n;
cin >> s;
bool f = false;
for (int i = 1; i < n; i++) {
for (int j = 0; j < n; j++)
if (s[j] == '*') {
int k = 1;
int r = j + i;
while (r < n && s[r] == '*') {
k++;
r += i;
}
if (k >= 5) f = true;
}
}
if (f)
cout << "yes";
else
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
void splitstr(const string &s, vector<string> &v) {
istringstream in(s);
copy(istream_iterator<string>(in), istream_iterator<string>(),
back_inserter(v));
}
void err(vector<string>::iterator it) {}
template <typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
cerr << *it << " = " << a << '\n';
err(++it, args...);
}
const int maxn = 100005;
const long long INF = (1e9) + 7;
const long double EPS = 1e-8;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
string s;
cin >> s;
for (int i = 1; i <= (int)n; i++) {
for (int p = 0; p < (int)n; p++) {
int j = p;
int q = 0;
while (j < n) {
if (s[j] == '.') {
while (j < n && s[j] == '.') j++;
q = 0;
}
q++;
if (q == 5) {
cout << "yes";
return 0;
}
j += i;
}
}
}
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
char s[100000];
int main() {
int m, n, j, k, l, t, ll;
bool is = false;
cin >> t;
cin >> s;
if (t < 5) {
cout << "no" << endl;
return 0;
}
l = t / 5;
ll = t % 5;
for (j = 0; j < t && !is; j++)
for (k = 1; k < t && !is; k++)
if (j + 4 * k < t && s[j] == '*' && s[j + 2 * k] == '*' &&
s[j + k] == '*' && s[j + 3 * k] == '*' && s[j + 4 * k] == '*') {
is = true;
}
if (is)
cout << "yes" << endl;
else
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string str;
cin >> str;
int cnt = 0;
int v[101] = {0};
vector<int> p;
for (int i = 0; i < n; i++)
if (str[i] == '*') {
cnt++;
v[i] = 1;
p.push_back(i);
}
if (cnt < 5)
cout << "no" << endl;
else {
int mx = n / 4;
for (int i = 1; i <= mx; i++) {
for (int j = 0; j < p.size(); j++) {
int c = 0;
for (int k = p[j]; k < n; k += i)
if (v[k] == 1)
c++;
else
break;
if (c == 5) {
cout << "yes" << endl;
return 0;
}
}
}
cout << "no" << endl;
return 0;
}
}
|
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int main() {
int n;
cin >> n;
string s;
cin >> s;
bool f = false;
for (int i = 0; i < s.size(); ++i)
for (int j = 1; j < 100; ++j) {
if (i + j * 4 < s.size())
if (s[i] == '*' && s[i + j] == '*' && s[i + j * 2] == '*' &&
s[i + j * 3] == '*' && s[i + j * 4] == '*') {
f = true;
}
}
if (f) {
cout << "yes";
} else {
cout << "no";
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n, a, d, i;
char s[105];
int main() {
scanf("%d%s", &n, s + 1);
for (a = 1; a < 100; a++) {
if (s[a] == '.') continue;
for (d = 1; d < 100; d++) {
if (a + 4 * d > n) continue;
for (i = 1; i < 5; i++) {
if (a + i * d > n || s[a + i * d] == '.') break;
}
if (i == 5) {
puts("yes");
return 0;
}
}
}
puts("no");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
int N;
cin >> N;
string s;
cin >> s;
for (int i = 1; i < N; ++i)
for (int j = 0; j < N; ++j) {
int cnt = 0;
for (int k = j; k < N && s[k] == '*'; cnt++, k += i)
;
if (cnt >= 5) {
cout << "yes" << endl;
exit(0);
}
}
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int N = 110;
int n;
string s;
int main() {
cin >> n >> s;
for (int i = 0; i < n; i++)
for (int j = 1; j < n; j++)
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>
using namespace std;
void solve() {
int n;
cin >> n;
string s;
cin >> s;
for (int i = 0; i < 100; i++) {
s += '-';
}
bool ok = false;
for (int i = 0; i < n; i++) {
if (s[i] == '*') {
for (int j = i + 1; j < n; j++) {
int dist = j - i;
if (s[j] == '*' && s[j + dist] == '*' && s[j + 2 * dist] == '*' &&
s[j + 3 * dist] == '*') {
ok = true;
}
}
}
}
if (ok)
cout << "yes\n";
else
cout << "no\n";
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
solve();
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
char ch[1000];
int n, f[1000];
int main() {
scanf("%d", &n);
scanf("%s", ch + 1);
n = strlen(ch + 1);
int flag = 0;
for (int i = 1; i <= n; i++) {
memset(f, 0xff, sizeof f);
for (int j = 1; j <= n; j++)
if (ch[j] == '*') {
if (j > i && ch[j - i] == '*')
f[j] = f[j - i] + 1;
else
f[j] = 1;
if (f[j] >= 5) flag = 1;
}
}
if (flag)
cout << "yes" << endl;
else
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const double PI = 3.141592653589793238463;
const int N = 1e6 + 10;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
;
int x;
cin >> x;
string s;
cin >> s;
vector<int> v;
for (int i = 0; i < x; i++) {
if (s[i] == '*') v.push_back(i);
}
for (int i = 0; i < v.size(); i++) {
int a[105] = {0};
int c = 0;
for (int j = i + 1; j < v.size(); j++) {
a[v[j] - v[i]]++;
}
for (int m = 1; m <= 25; m++) {
c = 0;
for (int k = m; k <= 100; k += m) {
if (a[k]) {
c++;
if (c == 4) {
cout << "yes\n";
return 0;
}
} else
break;
}
}
}
cout << "no\n";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n;
char crr[110];
int cal() {
for (int i = 1; i <= 100; i++) {
for (int j = 1; j <= 100; j++) {
int cn = 0;
for (int k = j; k <= 100; k += i) {
if (crr[k] == '*')
cn++;
else
break;
}
if (cn == 5) return 1;
}
}
return 0;
}
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> crr[i];
}
if (cal())
cout << "YES" << endl;
else
cout << "NO" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
void display(vector<int> vektor) {
int i;
for (i = 0; i < vektor.size(); i++) {
cout << vektor.at(i) << " ";
}
cout << endl;
}
int main() {
int g, n, i, h, pos1, pos2;
string level;
cin >> n >> level;
if (level.length() < 5) {
cout << "no" << endl;
return 0;
}
for (i = 0; i < level.length() - 4; i++) {
for (g = 1; g <= (level.length() - 1 - i) / 4; g++) {
if (level.at(i) == '*' && level.at(i + g) == '*' &&
level.at(i + g + g) == '*' && level.at(i + g + g + g) == '*' &&
level.at(i + g + g + g + g) == '*') {
cout << "yes" << endl;
return 0;
}
}
}
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
string s;
cin >> n;
cin >> s;
for (int i = 0; i < (n); ++i)
for (int j(1); j < (n); ++j)
if (i + 4 * j < n) {
bool ok = 1;
for (int k = 0; k < (5); ++k) {
if (s[i + k * j] != '*') {
ok = 0;
}
}
if (ok) {
cout << "yes" << endl;
return 0;
}
}
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int n;
scanf("%d", &n);
char level[100 + 1];
scanf("%s", level);
int a, d;
for (a = 0; a <= n - 5; a++) {
for (d = 1; d <= (n - 1) / 4; d++) {
if (level[a] == '*' && level[a + d] == '*' && level[a + 2 * d] == '*' &&
level[a + 3 * d] == '*' && level[a + 4 * d] == '*') {
printf("yes\n");
return 0;
}
}
}
printf("no\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
int n;
cin >> n >> s;
for (int i = 0; i < n; i++) {
if (s[i] == '.') continue;
for (int j = 1; j <= n / 4; j++) {
int ct = 0;
for (int k = i; k < n; k = k + j) {
if (s[k] == '.')
break;
else
ct++;
}
if (ct > 4) {
cout << "yes" << endl;
return 0;
}
}
}
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n, kol, ct;
char a[110];
int main() {
cin >> n;
for (int i = 1; i <= n; ++i) cin >> a[i], kol += (a[i] == '*');
if (kol < 5) {
cout << "no";
return 0;
}
for (int sz = 1; sz <= n; ++sz) {
for (int i = 1; i <= n; ++i) {
if (a[i] == '*') {
ct = 0;
for (int j = i; j <= n; j += sz) {
if (a[j] == '*')
++ct;
else
break;
if (ct >= 5) {
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 - 4; 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";
return 0;
}
}
}
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, jumps = 0;
string s;
cin >> n >> s;
for (int i = 0; i < n; i++) {
for (int j = 1; j < n; j++) {
jumps = 0;
for (int currJump = 0; currJump < 5 && i + j * currJump < n; currJump++) {
if (s.at(i + j * currJump) == '*') {
jumps++;
}
}
if (jumps >= 5) {
cout << "yes";
return 0;
}
}
}
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
char s[200];
cin >> n;
cin >> s;
int ok = 0;
for (int i = 0; i < n && !ok; i++) {
if (s[i] == '*') {
for (int k = 1; k <= n && !ok; k++) {
int num = 0;
for (int j = i; j < n && !ok; j += k) {
if (s[j] == '*')
num++;
else
break;
if (num == 5) ok = 1;
}
}
}
}
if (ok)
cout << "yes" << endl;
else
cout << "no" << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
int n;
cin >> n;
cin >> s;
int counter = 0;
int max = n / 4;
int amount = 0;
if (s.size() > 4) {
for (int i = 1; i <= max + 1; i++) {
int j = 0;
amount = 1;
while (s[j] == '.') {
j++;
}
int temp = j;
while (temp < n - 4 * i) {
j = temp;
if (amount == 0) {
while (s[j] == '.') {
j++;
}
}
temp = j;
while (j < n - i) {
j += i;
if (s[j] == '*') {
amount++;
} else {
amount = ((s[temp + 1] == '*') ? 1 : 0);
temp++;
j = temp;
break;
}
if (amount == 5) {
cout << "yes";
break;
}
}
if (amount == 5) {
break;
}
}
if (amount == 5) {
break;
}
}
}
if (amount < 5) cout << "no";
}
|
#include <bits/stdc++.h>
using namespace std;
int a[101];
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
char ch;
cin >> ch;
a[i] = ch == '*';
}
for (int i = 1; i < n; i++) {
if (a[i]) {
for (int j = 1; j <= (n - i) / 4; j++) {
if ((a[i + j] + a[i + 2 * j] + a[i + 3 * j] + a[i + 4 * j]) == 4) {
cout << "yes";
return 0;
}
}
}
}
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
return (b == 0) ? a : gcd(b, a % b);
}
long long int lcm(long long int a, long long int b) {
return (a * b) / gcd(a, b);
}
long long int modpow(long long int a, long long int n, long long int mod) {
long long int res = 1;
while (n) {
if (n & 1) res = (res * a) % mod;
a = (a * a) % mod;
n >>= 1;
}
return res;
}
long long int lpow(long long int a, long long int n) {
long long int res = 1;
while (n) {
if (n & 1) res *= a;
a *= a;
n >>= 1;
}
return res;
}
int n;
int a[110];
void Scan() {
cin >> n;
for (int i = 0; i < n; i++) {
char c;
cin >> c;
a[i] = ((c == '*') ? 1 : 0);
}
return;
}
int Out() {
for (int i = 0; i < n; i++) {
if (a[i] == 1)
for (int d = 1; d <= n; d++) {
int f = 0;
for (int j = 1; j <= 4; j++) {
int p = j * d;
if (i + p < n && a[i + p] == 1) f++;
}
if (f == 4) {
return 1;
}
}
}
return 0;
}
int main() {
Scan();
if (Out())
cout << "yes\n";
else
cout << "no\n";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long int n;
string s;
int main() {
cin >> n >> s;
for (long long int i = 0; i < n; ++i) {
for (long long int j = 1; 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");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483647, MOD = 1000 * 1000 * 1000 + 7;
const double eps = 1e-8;
void Error(string err) {
cout << err;
cerr << "_" << err << "_";
exit(0);
}
int gcd(int a, int b) { return (b == 0) ? a : gcd(b, a % b); }
const int sz = 100 * 1000;
int main() {
int n;
cin >> n;
string str;
cin >> str;
bool can[1000];
for (int i = 0; i < (n); i++) can[i] = (str[i] == '*');
bool good = false;
for (int k = 1; !good && k < n; k++) {
for (int i = 0; i < n && !good; i++) {
int cnt = 0;
for (int j = i; j < n; j += k) {
if (can[j])
cnt++;
else
break;
}
if (cnt > 4) good = true;
}
int cnt = 0;
}
if (good)
cout << "yes\n";
else
cout << "no\n";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
cerr << *it << " = " << a << endl;
err(++it, args...);
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int MOD = 1e9 + 7;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
string str;
cin >> str;
bool good = false;
for (long long int i = (1); i <= (long long int)(30); ++i) {
for (long long int j = (0); j <= (long long int)(n); ++j) {
if (j + (i * 4) >= n)
break;
else if (str[j] == '*' && str[j + i] == '*' && str[j + (2 * i)] == '*' &&
str[j + (3 * i)] == '*' && str[j + (4 * i)] == '*') {
good = true;
}
}
}
if (good)
cout << "yes";
else
cout << "no";
}
|
#include <bits/stdc++.h>
using namespace std;
int n;
string line;
int main() {
cin >> n >> line;
bool flag = false;
for (int i = 0; i < n; i++)
for (int len = 1; i + 4 * len < n; len++) {
bool f = true;
for (int j = 0; j < 5; j++)
if (line[i + len * j] == '.') {
f = false;
break;
}
if (f) {
flag = true;
break;
}
}
cout << (flag ? "yes" : "no") << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n;
string test;
bool yes;
int main() {
cin >> n;
cin >> test;
for (int i = 1; i <= n; ++i) {
for (int j = 0; j < n; ++j) {
int con = 0;
for (int k = j; k < n; k += i) {
if (test[k] == '*')
con++;
else
break;
}
if (con >= 5) {
yes = 1;
}
}
}
if (yes)
printf("yes\n");
else
printf("no\n");
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int n;
scanf("%d", &n);
char level[100 + 1];
scanf("%s", level);
int a, d;
for (a = 0; a <= n - 5; a++) {
for (d = 1; d <= (n - 1) / 4; d++) {
if (a + 4 * d < n) {
if (level[a] == '*' && level[a + d] == '*' && level[a + 2 * d] == '*' &&
level[a + 3 * d] == '*' && level[a + 4 * d] == '*') {
printf("yes\n");
return 0;
}
}
}
}
printf("no\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string l;
cin >> l;
for (int i = 0; i < n - 4; i++) {
if (l[i] == '*') {
for (int j = i + 1; j < n; j++) {
if (l[j] == '*' && i + (j - i) * 4 < n && l[i + (j - i) * 2] == '*' &&
l[i + (j - i) * 3] == '*' && l[i + (j - i) * 4] == '*') {
cout << "yes";
return 0;
}
}
}
}
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
bool a[n];
for (int i = 0; i < n; ++i) {
char c;
cin >> c;
a[i] = c == '*';
}
for (int i = 0; i < n - 4; ++i)
for (int j = 1; i + j * 4 < n; ++j)
for (int k = 0; k < 5; ++k)
if (!a[i + k * j])
break;
else if (k == 4) {
cout << "yes" << endl;
return 0;
}
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
string S;
cin >> N >> S;
for (int s = 0; s < N; s++) {
if (S[s] == '.') continue;
for (int step = 1; step < N; step++) {
int jumps = 0;
for (int i = s + step; i < N; i += step) {
if (S[i] == '.') break;
jumps++;
}
if (jumps >= 4) {
cout << "yes\n";
return 0;
}
}
}
cout << "no\n";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, a[100];
cin >> n;
string sp, s;
getline(cin, sp);
getline(cin, s);
for (int i = 0; i < s.size(); i++)
if (s[i] == '*')
a[i] = 1;
else
a[i] = 0;
for (int i = 0; i < n - 1; i++)
if (a[i] == 1) {
int sl = 0;
for (int j = i + 1; j < n; j++)
if (a[j] == 1) {
sl = 2;
int h = j - i;
for (int k = j + h; k < n; k += h)
if (a[k] == 1)
sl++;
else
break;
if (sl == 5) {
cout << "yes\n";
return 0;
}
}
}
cout << "no\n";
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
int n = 0;
int m = 0;
int count = 0;
int i, j, k;
int gap = 0;
int key = 0;
vector<int> A;
cin >> n;
cin >> s;
for (i = 0; i < n; i++)
if (s[i] == '*') {
m++;
A.push_back(i + 1);
}
for (i = 0; i < m - 1; i++) {
count = 0;
for (j = i + 1; j < m; j++) {
count = 0;
gap = A[j] - A[i];
count++;
key = A[j];
for (k = j + 1; k < m; k++) {
if (A[k] - key == gap) {
count++;
key = A[k];
}
}
if (count == 4) goto answer;
}
}
answer:
if (count == 4)
cout << "YES";
else
cout << "NO";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
char s[110];
int n;
bool vis[110];
int main() {
while (~scanf("%d", &n)) {
scanf("%s", s);
if (n < 5) {
printf("no\n");
continue;
}
int cnt = 0;
memset(vis, 0, sizeof(vis));
for (int i = 0; i < n; i++) {
if (s[i] == '*') {
cnt++;
vis[i] = 1;
}
}
if (cnt < 5) {
printf("no\n");
continue;
}
int flag = 0;
for (int i = 0; i < n; i++) {
if (flag) break;
if (vis[i]) {
for (int j = i + 1; j < n; j++) {
if (vis[j]) {
int x = j - i;
if (i + 4 * x >= n) break;
if (vis[j + x] && vis[j + 2 * x] && vis[j + 3 * x]) {
flag = 1;
break;
}
}
}
}
}
if (flag)
printf("yes\n");
else
printf("no\n");
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
char str[105];
int main() {
int n, i, j, k, l, c, r;
while (scanf("%d", &n) != EOF) {
scanf("%s", str);
l = 0;
r = 0;
for (i = 0; i < n - 4; i++) {
for (j = 1; j <= 24 - l; j++) {
c = 0;
for (k = i; k < n; k += j) {
if (str[k] == '*')
c++;
else
break;
}
if (c >= 5) {
r = 1;
break;
}
}
if (r) break;
if ((i % 4) == 3) l++;
}
if (r)
printf("yes\n");
else
printf("no\n");
}
return 0;
}
|
#include <bits/stdc++.h>
int arr[105];
int main(void) {
int n, ok = 0;
char te;
scanf("%d", &n);
int c;
c = n / 4;
for (int k = 1; k <= n; k++) {
scanf(" %c", &te);
if (te == '*') arr[k] = 1;
}
for (int i = 1; i <= c; i++) {
for (int j = 1; j + i * 4 <= n; j++) {
if (arr[j] && arr[j + i] && arr[j + 2 * i] && arr[j + 3 * i] &&
arr[j + 4 * i])
ok = 1;
}
}
if (ok)
printf("yes");
else
printf("no");
}
|
#include <bits/stdc++.h>
using namespace std;
const int INF = 1E9;
int main() {
int n;
string s;
cin >> n >> s;
for (int len = 1; len <= n; len++) {
bool ok = true;
for (int i = 0; i < n; i++) {
if (i + len * 4 < n && s[i] == '*' && s[i] == s[i + len] &&
s[i] == s[i + len + len] && s[i] == s[i + len * 3] &&
s[i] == s[i + len * 4]) {
ok = 0;
break;
}
}
if (!ok) {
puts("yes");
return 0;
}
}
puts("no");
return 0;
}
|
#include <bits/stdc++.h>
int main() {
unsigned n;
scanf("%u", &n);
char level[200];
scanf("%s", level);
for (unsigned start = 0; start < n; ++start) {
for (unsigned step = 1; step < n; ++step) {
unsigned idx = start;
bool result = true;
for (unsigned i = 0; i < 5; ++i) {
result = result && (idx < n) && (level[idx] == '*');
idx += step;
}
if (result) {
printf("yes");
return 0;
}
}
}
printf("no");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n;
string s;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int i, j, k;
cin >> n >> s;
for (i = 0; i < n; i++) {
for (j = 1; j <= (n - i) / 3; j++) {
for (k = 0; k < 5; k++) {
if (s[i + k * j] != '*') k = 100;
}
if (k == 5) {
cout << "yes";
return 0;
}
}
}
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, i, j = 0, k, c = 0;
bool good = false;
string s;
cin >> n >> s;
for (i = 0; i < n; i++) {
if (s[i] == '*') {
for (j = 1; j < n; j++) {
c = 0;
for (k = i; k < n; k += j) {
if (s[k] == '*')
c++;
else
break;
if (c > 4) good = true;
}
}
}
}
if (good)
cout << "yes";
else
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n, m;
char mp[105];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf(" %c", &mp[i]);
}
for (int s = 1; s <= n; s++)
for (int i = 1; i <= n; i++) {
int yes = 1;
for (int j = 0; j < 5; j++)
if (j * s + i > n || mp[j * s + i] == '.') {
yes = 0;
break;
}
if (yes) return printf("yes"), 0;
}
printf("no");
scanf(" ");
}
|
#include <bits/stdc++.h>
using namespace std;
int n, cnt;
string s;
int main() {
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
;
cin >> n >> s;
for (int i = 0; i < n; ++i) {
for (int j = 1; j < n; ++j, cnt = 0) {
for (int k = i, on = 5; on && k < n; k += j, --on) cnt += s[k] == '*';
if (cnt == 5) return cout << "yes\n", 0;
}
}
cout << "no\n";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, i, j, a[105][105];
string s;
cin >> n;
cin >> s;
for (i = 0; i < n; ++i)
if (s[i] == '*') {
for (j = 1; j <= i; ++j) {
if (s[i - j] == '*') {
a[i][j] = a[i - j][j] + 1;
if (a[i][j] == 4) {
cout << "yes";
return 0;
}
}
}
}
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string r;
cin >> r;
for (int i = 0; i < n; i++) {
for (int j = 1; j <= n; j++) {
bool good = true;
for (int x = 0; x < 5; x++) {
if ((i + x * j) > n - 1) {
good = false;
break;
}
if (r.at((i + x * j)) == '.') {
good = false;
break;
}
}
if (good) {
cout << "yes" << endl;
return 0;
}
}
}
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(NULL);
;
long long int n;
cin >> n;
string s;
cin >> s;
bool allowed = false;
for (int i = 0; i < s.size(); i++) {
if (s[i] == '*') {
for (int j = 1; j < s.size(); j++) {
for (int k = 0; k < 4; k++) {
if (i + j * (k + 1) >= s.size()) goto down;
if (s[i + j * (k + 1)] == '*')
continue;
else
goto down;
}
allowed = true;
down:;
}
}
}
if (allowed)
cout << "yes" << endl;
else
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
char map[105];
int main() {
bool flag = 0;
int i, j, n, ind, len, sum;
string s;
while (~scanf("%d", &n)) {
cin >> s;
flag = 0;
len = s.length();
for (i = 0; i < len; i++) {
if (s[i] == '*') {
for (j = 1; i + 4 * j <= len; j++) {
if (s[i + j] == '*' && s[i + 2 * j] == '*' && s[i + 3 * j] == '*' &&
s[i + 4 * j] == '*') {
flag = 1;
goto wha;
}
}
}
}
wha:
if (flag == 1)
printf("yes\n");
else
printf("no\n");
}
}
|
#include <bits/stdc++.h>
const double EPS = 1e-24;
const long long int MOD = 1000000007ll;
const double PI = 3.14159265359;
int INF = 2147483645;
template <class T>
T Max2(T a, T b) {
return a < b ? b : a;
}
template <class T>
T Min2(T a, T b) {
return a < b ? a : b;
}
template <class T>
T Max3(T a, T b, T c) {
return Max2(Max2(a, b), c);
}
template <class T>
T Min3(T a, T b, T c) {
return Min2(Min2(a, b), c);
}
template <class T>
T Max4(T a, T b, T c, T d) {
return Max2(Max2(a, b), Max2(c, d));
}
template <class T>
T Min4(T a, T b, T c, T d) {
return Min2(Min2(a, b), Max2(c, d));
}
template <class T>
void Swap(T& a, T& b) {
T temp;
temp = a;
a = b;
b = temp;
}
using namespace std;
int main() {
std::ios::sync_with_stdio(false);
int n;
cin >> n;
string s;
cin >> s;
for (int i = 1; i < 25; i++) {
for (int j = 0; j + 4 * i < 100; j++) {
if (s[j] == s[j + i] && s[j + i] == s[j + 2 * i] &&
s[j + 2 * i] == s[j + 3 * i] && s[j + 3 * i] == s[j + 4 * i] &&
s[j] == '*') {
cout << "yes";
return 0;
}
}
}
cout << "no";
return 0;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string level;
cin >> level;
for (int s = 0; s < n; ++s) {
for (int i = 1; i <= 25; ++i) {
bool possible = true;
int count = 5;
for (int j = s; j < n; j += i) {
if (level[j] == '.') {
possible = false;
break;
} else {
count--;
if (count == 0) break;
}
}
if (possible && count == 0) {
cout << "yes" << endl;
return 0;
}
}
}
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
char st[1234561];
int main() {
int n;
scanf("%d%s", &n, st);
int k = n / 4;
for (int i = 1; i <= k; i++) {
for (int j = 0; st[j]; j++) {
if (st[j] == '*' && st[j + i] == '*' && st[j + 2 * i] == '*' &&
st[j + 3 * i] == '*' && st[j + 4 * i] == '*')
return puts("yes");
}
}
puts("no");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int maxN = 101;
int main() {
int n, maxJump[maxN][maxN] = {};
char level[maxN];
cin >> n >> level;
for (int i = 0; i < n; i++)
if (level[i] == '*')
for (int j = 0; j < n; j++) {
if (j <= i) {
maxJump[i][j] = maxJump[i - j][j] + 1;
if (maxJump[i][j] == 5) {
cout << "yes " << endl;
return 0;
}
} else
maxJump[i][j] = 1;
}
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(NULL);
int n;
string s;
cin >> n >> s;
bool flag = false;
for (int i = 0; i <= n - 5; i++) {
for (int j = 1; i + 4 * j < n; j++) {
if (s[i] == '*' and s[i + j] == '*' and s[i + 2 * j] == '*' and
s[i + 3 * j] == '*' and s[i + 4 * j] == '*') {
flag = true;
break;
}
}
}
if (flag)
cout << "yes";
else
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
char s[100000];
int main() {
int N, i, j, l, v;
bool ans;
scanf("%d%s", &N, &s);
for (int l = 1; l <= N; l++) {
for (int i = 0; i < N; i++) {
ans = true;
for (j = 0; j < 5; j++) {
v = i + j * l;
if (v >= N || s[v] == '.') ans = false;
}
if (ans) {
printf("yes");
return 0;
}
}
}
printf("no");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, i, j, fl = 0;
scanf("%d", &n);
string s;
cin >> s;
for (i = 0; i < n; i++) {
if (s[i] == '*') {
for (j = 1; j <= 30; j++) {
int jump = i;
int cnt = 1;
while (s[jump + j] == '*' && jump + j <= n) {
cnt++;
jump = jump + j;
if (cnt == 5) break;
}
if (cnt == 5) {
fl = 1;
break;
}
}
}
}
if (fl)
printf("yes\n");
else
printf("no\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
char str[105];
int judge(int n) {
int i, j, len;
for (i = 0; i < n; i++) {
if (str[i] == '*')
for (j = i + 1; j < n; j++)
if (str[j] == '*') {
len = j - i;
if (j + 3 * len < n && str[j + len] == '*' &&
str[j + 2 * len] == '*' && str[j + 3 * len] == '*')
return 1;
}
}
return 0;
}
int main() {
int n;
while (scanf("%d", &n) != EOF) {
scanf("%s", str);
if (judge(n))
printf("yes\n");
else
printf("no\n");
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
char s[105];
int main() {
int n;
scanf("%d", &n);
scanf("%s", s);
bool isok = 0;
for (int i = 0; i < n; i++) {
if (s[i] == '*') {
for (int j = 1; j < n; j++) {
int k;
for (k = 0; k <= 4 && i + j * k < n; k++) {
if (s[i + j * k] == '.') break;
}
if (k == 5) isok = 1;
}
}
}
if (isok)
printf("yes");
else
printf("no");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
inline void read(int &x) {
char ch;
int t = 0;
x = 0;
for (ch = getchar(); ch < '0' || ch > '9'; ch = getchar())
if (ch == '-') t = 1;
for (; ch >= '0' && ch <= '9'; x = x * 10 + ch - 48, ch = getchar())
;
if (t) x = -x;
}
const int N = 105, mod = 1e9 + 7;
char str[N];
int main() {
int n, i, j, k, l, r, p, T, m;
int s, t, x, y, a, b;
while (~scanf("%d", &n)) {
scanf("%s", str);
for (i = 0; i < n; i++) {
for (j = 1; j < n; j++) {
for (k = 0; k < 5; k++)
if (i + k * j >= n || str[i + k * j] != '*') break;
if (k == 5) goto out;
}
}
out:
if (k == 5)
printf("yes\n");
else
printf("no\n");
}
return 0;
}
|
#include <bits/stdc++.h>
int good(char *s, int n, int l, int i) {
return i + l * 4 < n && s[i] == '*' && s[i + l] == '*' &&
s[i + (l * 2)] == '*' && s[i + (l * 3)] == '*' &&
s[i + (l * 4)] == '*';
}
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;
const int N = 1e5 + 5;
int n, a[N];
int main() {
ios_base::sync_with_stdio(false);
string s;
cin >> n >> s;
for (int i = 0; i < n; i++)
for (int len = 1; i + 4 * len < n; len++) {
bool flag = false;
for (int j = 0; j < 5; j++)
if (s[i + j * len] == '.') flag = true;
if (!flag) {
cout << "yes\n";
return 0;
}
}
cout << "no\n";
return 0;
}
|
#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
const long double PI = 3.14159265358979323846;
const long double gammama = 0.57721566490153286060;
const long double eps = 1e-5;
const int INF = 1000 * 1000 * 1000 + 1;
const long long LINF = (long long)1000 * 1000 * 1000 * 1000 * 1000 * 1000;
const long long mod = 1000 * 1000 * 1000 + 7;
const long long N = 1001;
void solve() {
int n;
cin >> n;
string s;
cin >> s;
int res = 0;
for (int d = 1; d < n; ++d) {
vector<int> a(n, 0);
int m = 0;
for (int i = 0; i < n; ++i) {
if (s[i] == '.')
a[i] = 0;
else {
if (i - d >= 0) {
a[i] = a[i - d] + 1;
} else
a[i] = 1;
}
m = max(m, a[i]);
}
res = max(res, m);
}
if (res >= 5)
cout << "yes";
else
cout << "no";
cout << endl;
}
int main() {
solve();
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
char a[110];
int n;
int main() {
cin >> n;
for (int i = 1; i <= n; i++) cin >> a[i];
for (int i = 1; i <= n; i++) {
if (a[i] == '*') {
for (int d = 1; d <= n; d++) {
if (i + d * 4 > n) break;
if (a[i] == '*' && a[i + d] == '*' && a[i + d * 2] == '*' &&
a[i + d * 3] == '*' && a[i + d * 4] == '*') {
cout << "yes" << endl;
return 0;
}
}
}
}
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
string s;
cin >> n >> s;
for (int c = 1; c < n; ++c) {
for (int i = 0; i < n; ++i) {
if (i + c * 4 < n) {
bool ok = true;
for (int j = i; j <= i + c * 4; j += c) {
if (s[j] == '.') ok = false;
}
if (ok) {
cout << "yes";
return 0;
}
}
}
}
cout << "no";
}
|
#include <bits/stdc++.h>
using namespace std;
int n;
string s;
bool check(int x, int y) {
int u = 0;
for (int i = x; i < n; i += y) {
if (s[i] == '.') return false;
u++;
if (u == 5) return true;
}
return false;
}
int main() {
ios::sync_with_stdio(false);
cin >> n >> s;
for (int i = 0; i < n; i++) {
for (int j = 1; j < n - i; j++) {
if (check(i, j)) {
cout << "yes";
return 0;
}
}
}
cout << "no";
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, arr[101], b = 0, i, j, k, m, ctr = 0;
cin >> n;
char ch[101];
cin >> ch;
for (i = 0; i < n; i++) {
if (ch[i] == '*') {
arr[b] = i + 1;
b++;
}
}
for (i = 1; i <= 100; i++) {
for (j = 0; j < b; j++) {
ctr = 1;
m = arr[j] + i;
if (j != b - 1) {
for (k = j + 1; m >= arr[k]; k++) {
if (m == arr[k]) {
ctr++;
m += i;
}
if (ctr == 5) {
cout << "yes";
return 0;
}
}
}
}
}
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
bool check = false;
string s;
int n, step = 0;
cin >> n;
cin >> s;
for (int j = 1; j <= s.length() - 1; j++) {
for (int i = 0; i < s.length() - 4 * j; i++) {
if (i + 4 * j > s.length() - 1) break;
if (s[i] == '*' && s[i + j] == '*' && s[i + 2 * j] == '*' &&
s[i + 3 * j] == '*' && s[i + 4 * j] == '*') {
check = true;
break;
}
}
if (check) break;
}
if (check)
cout << "yes";
else
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n, i, k;
int j, t;
char s[111];
void solve() {
scanf("%d\n%s", &n, &s);
for (i = 1; i < n; i++) {
for (j = 0; j < n; j++) {
t = 0;
for (k = j; k < n; k += i) {
if (s[k] == '*') {
t++;
if (t == 5) {
printf("yes");
return;
}
} else
t = 0;
}
}
}
puts("no");
}
int main() { solve(); }
|
#include <bits/stdc++.h>
using namespace std;
int main() {
char a[101];
int n;
scanf("%d", &n);
scanf("%s", a);
int i, j;
for (i = 1; i <= n; i++) {
for (j = 0; j < n; j++) {
if (a[j] == '*' && j + i != n && j + 2 * i != n && j + 3 * i != n &&
j + 4 * i != n && a[j] == '*' && a[j + i] == '*' &&
a[j + 2 * i] == '*' && a[j + 3 * i] == '*' && a[j + 4 * i] == '*') {
printf("yes\n");
return 0;
}
}
}
printf("no\n");
return 0;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
string lvl;
cin >> n >> lvl;
bool success;
for (int i = 0; i < n; ++i) {
if (lvl[i] == '*') {
for (int j = 1; j <= (n - i - 1) / 4; ++j) {
success = true;
for (int k = 1; k <= 4; ++k) {
if (lvl[i + k * j] == '.') {
success = false;
break;
}
}
if (success) break;
}
}
if (success) break;
}
if (success)
cout << "yes";
else
cout << "no";
}
|
#include <bits/stdc++.h>
using namespace std;
int main(void) {
int n;
cin >> n;
string s;
cin >> s;
bool found = false;
for (int len = 1; len <= s.length() / 4; len++) {
for (int start = 0; start + 4 * len < s.length(); start++) {
bool poss = true;
for (int kk = 0; kk <= 4; kk++) {
if (s[start + len * kk] != '*') {
poss = false;
}
}
if (poss) {
found = true;
}
}
}
if (found) {
printf("yes");
} else {
printf("no");
}
return 0;
}
|
#include <bits/stdc++.h>
char in[104];
int main() {
int i, j, k, n;
bool f = 0;
scanf("%d %s", &n, in + 1);
for (i = 1; i <= n; ++i) {
if (in[i] != '*') continue;
for (k = 1; (k << 2) + i <= n; ++k) {
for (j = 1; j <= 4; ++j) {
if (in[i + k * j] != '*') break;
}
if (j == 5) {
f = 1;
break;
}
}
if (f) break;
}
if (f)
puts("yes");
else
puts("no");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, c = 0, y = 0, sol = 0;
char s;
cin >> n;
int x[n];
for (int i = 1; i <= n; i++) {
cin >> s;
if (s == '*') {
x[c] = i;
c++;
}
}
for (int i = 0; i < c; i++) {
for (int j = i + 1; j < c; j++) {
y = x[j] - x[i];
n = j;
sol = 0;
for (int k = j + 1; k < c; k++) {
if (x[k] - x[n] == y) {
sol++;
n = k;
} else if (x[k] - x[n] > y)
break;
}
if (sol >= 3) {
cout << "YES";
return 0;
}
}
}
cout << "NO";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int max_n = 111, inf = 1111111111;
int n;
string s;
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] == '*') {
int d = j - i, x = j, f = 0;
for (int k = 0; k < 3; ++k) {
x += d;
if (x >= n || s[x] == '.') {
f = 1;
break;
}
}
if (f == 0) {
cout << "yes" << endl;
return 0;
}
}
}
}
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int N = 100001;
const long long INF = 1ll << 51;
int n;
string str;
int main() {
scanf("%d", &n);
cin >> str;
for (int i = 0; i < n; ++i) {
if (str[i] == '*')
for (int j = 1; j <= n; ++j) {
int cnt = 0;
for (int k = i + j; k < n; k += j) {
if (str[k] == '*')
++cnt;
else
break;
if (cnt == 4) {
cout << "yes" << endl;
return 0;
}
}
}
}
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int len;
cin >> len;
char *string = new char[len + 1];
cin.ignore();
cin.getline(string, len + 1);
int count;
for (int i = 1; i < len; i++) {
int arr = 0;
count = 0;
for (int j = 0; j < len; j += i) {
if (string[j] == '*')
count++;
else {
count = 0;
j = ++arr - i;
}
if (count == 5) {
cout << "yes";
return 0;
}
}
}
cout << "no";
}
|
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int SIZE = 1e6 + 10;
char s[SIZE];
int main() {
int(n);
scanf("%d", &n);
scanf("%s", (s));
bool suc = 0;
for (int i = (1); i < (100); ++i) {
for (int j = 0; j < (n); ++j) {
bool fail = 0;
for (int k = 0; k < (5); ++k) {
if (j + i * k >= n || s[j + i * k] == '.') {
fail = 1;
break;
}
}
if (!fail) suc = 1;
}
}
puts(suc ? "yes" : "no");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
string type;
int n;
bool checkGoodJump(int step) {
for (int i = 0; i + 4 * step < n; ++i) {
if (type[i] == '*' && type[i + step] == '*' && type[i + 2 * step] == '*' &&
type[i + 3 * step] == '*' && type[i + 4 * step] == '*')
return true;
}
return false;
}
int main() {
cin >> n;
cin >> type;
bool ok = 0;
for (int i = 1; i <= 25; ++i)
if (checkGoodJump(i)) {
ok = 1;
break;
}
if (ok == 1)
cout << "yes";
else
cout << "no";
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<char> v(n);
for (auto& x : v) cin >> x;
for (int i = 0; i <= n - 5; i++) {
for (int j = 1; j <= (n - 1 - i) / 4; j++) {
if (v[i] == '*' && v[i + j] == '*' && v[i + 2 * j] == '*' &&
v[i + 3 * j] == '*' && v[i + 4 * j] == '*') {
cout << "YES";
return 0;
}
}
}
cout << "NO";
}
|
#include <bits/stdc++.h>
using namespace std;
const long long maxll = numeric_limits<long long>::max();
const int maxint = numeric_limits<int>::max();
const long long md = 1e9 + 7;
const long double eps = 1e-6;
string s;
bool ok;
void rec(int now, int skok, int ans) {
if (s[now] == '.') return;
if (ans == 5) {
ok = true;
return;
}
if (now + skok < s.length()) rec(now + skok, skok, ans + 1);
}
int main() {
cin >> s >> s;
for (int i = 0; i < s.length(); i++) {
if (ok) break;
if (s[i] == '*')
for (int j = 1; j < s.length(); j++) rec(i, j, 1);
}
printf((ok) ? "yes" : "no");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string s;
cin >> s;
int i, j;
vector<int> a;
for (i = 0; i < n; i++)
if (s[i] == '*') a.push_back(i);
if (a.size() == 0) {
cout << "no";
return 0;
}
for (int k = 0; k < a.size(); k++) {
for (i = 1; i <= n; i++) {
int d = 0;
for (j = a[k] + i; j < n; j += i) {
if (s[j] == '*')
d++;
else
break;
}
if (d == 4) {
cout << "yes";
return 0;
}
}
}
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const long double EPS = 1e-9;
const long double INF = (long double)1e59;
const int N = (int)1e5 + 5;
const int M = (int)1e9 + 7;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
string s;
int n;
int p[N];
int main() {
cin >> n >> s;
for (int i = 0; i < n; i++)
if (s[i] == '*') p[i] = 1;
for (int i = 0; i < n; i++)
if (s[i] == '*')
for (int j = 1; j <= n; j++) {
int cnt = 0;
for (int k = i; k < n && cnt < 5; k += j, cnt++)
if (!p[k]) {
cnt = 0;
break;
}
if (cnt == 5) {
cout << "yes";
return 0;
}
}
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n;
string s;
int main() {
cin >> n >> s;
for (int i = 0; i < n; i++) {
if (s[i] == '.') continue;
for (int d = 1; d < n; d++) {
int sum = 0;
for (int j = i; j < n; j += d) {
if (s[j] == '.') break;
sum++;
}
if (sum >= 5) {
cout << "yes";
exit(0);
}
}
}
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int maxn = 100100;
const int maxm = 600100;
const int inf = 1e8;
const int mod = 1e9 + 7;
int n, m;
char s[maxn];
int main() {
int i, j;
scanf("%d", &n);
scanf("%s", s + 1);
for (i = 0; i <= 24; i++) {
for (j = 1; j + 4 * i + 4 <= n; j++) {
if (s[j] == '*' && s[j + i + 1] == '*' && s[j + 2 * i + 2] == '*' &&
s[j + 3 * i + 3] == '*' && s[j + 4 * i + 4] == '*') {
printf("yes\n");
return 0;
}
}
}
printf("no\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
string s;
while (cin >> n >> s) {
bool ok = 0;
for (int i = 0; i < n; ++i) {
for (int L = 1; L <= 100; ++L) {
int cnt = 0;
for (int k = 0; k < 5; ++k)
if (i + k * L < n && s[i + k * L] == '*') cnt++;
if (cnt == 5) ok = 1;
}
}
puts(ok ? "yes" : "no");
}
}
|
#include <bits/stdc++.h>
using namespace std;
int A[199];
int n;
inline void check(int x, int d) {
int i = 1;
for (i = 1; x <= n && i <= 4; i++) {
if (!A[x]) return;
x += d;
}
if (!A[x]) return;
if (i == 5) {
cout << "yes\n";
exit(0);
}
}
int main() {
ios_base::sync_with_stdio(false);
cin >> n;
for (int i = 1; i <= n; i++) {
char c;
cin >> c;
if (c == '*') A[i] = true;
}
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++) check(i, j);
cout << "no\n";
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
scanf("%d", &n);
char s[n + 2];
scanf("%s", s);
for (int i = 1; i <= n; i++) {
for (int k = 0; k < n; k++) {
int c = 0;
for (int j = k; j < n; j += i) {
if (s[j] == '*')
c++;
else
c = 0;
if (c == 5) {
printf("yes");
return 0;
}
}
}
}
printf("no");
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
string s;
cin >> n;
cin >> s;
bool finalok = false;
for (int i = 1; i < n; i++) {
for (int j = 0; j < n; j++) {
int count = 0;
bool ok = true;
for (int k = j; count < 5 and k < n; k += i) {
if (s[k] == '.') {
ok = false;
break;
}
count++;
}
if (ok and count == 5) {
finalok = true;
}
}
if (finalok) {
break;
}
}
if (finalok) {
cout << "yes" << endl;
} else {
cout << "no" << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long isg[109];
long long n;
int main() {
cin.tie(0);
ios::sync_with_stdio(0);
cin >> n;
char tp;
for (long long i = 0; i < (n); ++i) {
cin >> tp;
isg[i] = (tp == '*');
}
for (long long st = 0; st < (n); ++st) {
for (long long jp = 1; jp <= n; jp++) {
long long okc = 0;
for (long long i = st; i < n && i <= (st + 4 * jp); i += jp)
okc += isg[i];
if (okc == 5) {
cout << "yes" << endl;
return 0;
}
}
}
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n;
char str[105];
bool flag;
int main() {
while (~scanf("%d", &n)) {
flag = false;
scanf("%s", str);
int cnt = (n + 1) >> 2;
for (int i = 0; i <= n; i++) {
for (int j = 1; j <= cnt; j++) {
if (str[i] == '*' && str[i + j] == '*' && str[i + 2 * j] == '*' &&
str[i + 3 * j] == '*' && str[i + 4 * j] == '*') {
flag = true;
break;
}
}
}
if (flag)
puts("yes");
else
puts("no");
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
char ch[101];
int i, k, l, m, n, o;
int main() {
scanf("%d\n", &n);
scanf("%s", &ch);
for (int q = 0; q < n; q++) {
l = 0;
if (ch[q] == '.') continue;
for (i = 1; i <= (n - q) / 4; i++) {
k = q;
for (int j = 0; j < 4; j++) {
k += i;
if (ch[k] == '.' || k >= n) {
l++;
break;
}
}
}
if (l < i - 1) {
printf("yes");
return 0;
}
}
printf("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 = i + 1; j < n; j++) {
int jumps = 0;
int now = j;
while (now < n && jumps < 4 && s[now] == '*') {
jumps++;
now += j - i;
}
if (jumps == 4) {
cout << "yes" << endl;
return 0;
}
}
}
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace ::std;
int n, t, s, f;
int a[102];
bool go(int from, int step) {
if (a[from] && (from + step < n && a[from + step]) &&
(from + 2 * step < n && a[from + 2 * step]) &&
(from + 3 * step < n && a[from + 3 * step]) &&
(from + 4 * step < n && a[from + 4 * step]))
return true;
else
return false;
}
int main(int argc, const char* argv[]) {
ios::sync_with_stdio(0);
cin >> n;
char x;
for (int i = 0; i < n; i++) {
cin >> x;
if (x == '*') a[i] = 1;
}
int st = 0;
while (a[st] != 1) st++;
while (st + 2 < n) {
if (a[st])
for (int i = 1; i <= (n - st + 1) / 4; i++) {
if (go(st, i)) {
cout << "yes\n";
return 0;
}
}
st++;
}
cout << "no\n";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int(n);
(cin) >> (n);
string s;
cin >> s;
for (int(i) = (0); (i) < (n); ++(i)) {
if (s[i] == '*') {
for (int(j) = (1); (j) < (n); ++(j)) {
int cnt = 0;
int k = i + j;
while (k < n && s[k] == '*') {
k += j;
cnt++;
}
if (cnt >= 4) {
cout << ("yes") << (endl);
return 0;
}
}
}
}
cout << ("no") << (endl);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
int r;
while (b != 0) {
r = a % b;
a = b;
b = r;
}
return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
int getBit(int s, int i) { return (s >> i) & 1; }
int onBit(int s, int i) { return s | (int(1) << i); }
int offBit(int s, int i) { return s & (~(int(1) << i)); }
int cntBit(int s) { return __builtin_popcount(s); }
int sqr(int x) { return x * x; };
const int MOD = 1e9 + 7;
const int SIZE = 1e6 + 10;
const int DX[4] = {-1, 1, 0, 0};
const int DY[4] = {0, 0, 1, -1};
string s;
int n;
bool isGood(int len) {
for (int start = (0), _b = (n); start < _b; ++start)
if (s[start] == '*') {
int cnt = 0;
int i = start;
while (i < n && s[i] == '*') {
cnt++;
i += len;
}
if (cnt >= 5) return true;
}
return false;
}
int main() {
scanf("%d\n", &n);
cin >> s;
for (int len = (1), _b = (n - 1); len <= _b; len++)
if (isGood(len)) {
cout << "yes";
return 0;
}
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
cout.sync_with_stdio(false);
int x;
cin >> x;
string path;
cin >> path;
for (int i = 0; i < path.length(); i++) {
if (path[i] == '.') continue;
for (int j = 1; j <= path.length() / 4; j++) {
int count = 0;
for (int k = i + j; k < path.length(); k += j) {
if (path[k] == '*')
count++;
else
break;
}
if (count >= 4) {
cout << "yes";
return 0;
}
}
}
cout << "no";
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
string s;
s = s + ".....";
scanf("%d", &n);
cin >> s;
for (int j = 0; j < n - 4; j++)
for (int i = 1; i <= (n - j) / 4; i++) {
if (s[j] == '*' && s[j] == s[j + i] && s[j] == s[j + i + i] &&
s[j] == s[j + i + i + i] && s[j] == s[j + i + i + i + i]) {
cout << "yes";
return 0;
}
}
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
char s[105];
int main(void) {
int n, f;
while (cin >> n) {
scanf("%s", s);
f = 0;
for (int l = (1); l <= (n); ++l) {
for (int j = (0); j <= (n - 4 * l - 1); ++j) {
if (j + 4 * l >= n) break;
if (s[j] == '*' && s[j + l] == '*' && s[j + 2 * l] == '*' &&
s[j + 3 * l] == '*' && s[j + 4 * l] == '*') {
f = 1;
break;
}
}
if (f) break;
}
if (f)
cout << "yes\n";
else
cout << "no\n";
}
return 0;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.