text stringlengths 49 983k |
|---|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
char a[111];
cin >> n >> a;
for (int i = 0; i < n; ++i) {
if (a[i] != '*') continue;
for (int j = i + 1; j < n; ++j) {
if (a[j] != '*') continue;
int d = j - i;
int f = 1;
for (int k = 1; k < 4; ++k) {
if (a[j + k * d] != '*') f = 0;
}
if (f) {
cout << "yes\n";
return 0;
}
}
}
cout << "no\n";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
string s;
int main() {
int n;
cin >> n;
cin >> s;
int len = s.size();
int t = 0;
for (int i = 0; i < len; i++) {
if (s[i] == '.') continue;
for (int j = i + 1; j < len; j++) {
if (s[j] == '.') continue;
int l = j - i, r = j, k;
for (k = 0; k < 3; k++) {
r += l;
if (r >= len || s[r] == '.') break;
}
if (k >= 3) {
t = 1;
break;
}
}
if (t) break;
}
if (t)
printf("yes\n");
else
printf("no\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
char a[105];
int n;
int main() {
cin >> n;
for (int i = 0; i < n; i++) cin >> a[i];
if (n < 5)
cout << "no\n";
else {
for (int i = 0; i < n - 4; i++)
for (int j = 1; 4 * j + i < n; j++) {
if (a[i] == '*' && a[i + j] == '*' && a[i + 2 * j] == '*' &&
a[i + 3 * j] == '*' && a[i + 4 * j] == '*') {
cout << "yes\n";
return 0;
}
}
cout << "no\n";
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, a;
vector<char> v;
cin >> n;
v.push_back('.');
for (int i = 0; i < n; i++) {
char ch;
cin >> ch;
v.push_back(ch);
}
for (int i = 0; i < 100; i++) {
char ch;
ch = '.';
v.push_back(ch);
}
for (int i = 1; i <= n; i++) {
if (v[i] == '*') {
a = i;
for (int i = 1; i <= 25; i++) {
if (v[a + i] == '*' && v[a + 2 * i] == '*' && v[a + 3 * i] == '*' &&
v[a + 4 * i] == '*') {
cout << "yes";
exit(0);
}
}
}
}
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, flag = 0;
cin >> n;
char a[1000];
for (int i = 1; i <= n; i++) cin >> a[i];
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n / 3; j++) {
int k = i;
int p = 0;
while (a[k] == '*' && p < 5) {
k += j;
p++;
}
if (p >= 5) {
cout << "yes" << endl;
flag = 1;
}
if (flag == 1) break;
}
if (flag == 1) break;
}
if (flag == 0) cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int N;
char S[200];
int check(int j) { return j < N && S[j] == '*'; }
int main(void) {
scanf("%d\n", &N);
gets(S);
for (int i = 0; i < N; i++)
if (check(i))
for (int j = 1; j < N; j++)
if (check(i + j) && check(i + 2 * j) && check(i + 3 * j) &&
check(i + 4 * j)) {
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 = 1; i <= n; i++) {
for (int x = 0; x < n; x++) {
if (s[x] == '.') continue;
int j = x;
int num = 1;
while (j < n) {
j += i;
if (j < n && s[j] == '*')
num++;
else
break;
}
if (num >= 5) {
cout << "yes" << endl;
return 0;
}
}
}
cout << "no" << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
bool testc(int tc = 0) {
int n;
scanf("%i ", &n);
char buf[1000];
gets(buf);
for (int i = 0; i < n; i++) {
int k = 0;
if (buf[i] == '.') continue;
for (int j = 1; j < n; j++) {
for (int k = 1;; k++) {
if (k >= 5) {
printf("yes\n");
return true;
}
if (i + j * k >= n || buf[i + j * k] == '.') {
break;
}
}
}
}
printf("no\n");
}
int main() {
testc();
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n;
char A[200];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n;
for (int i = 1; i <= n; i++) cin >> A[i];
for (int i = 1; i <= n; i++) {
for (int j = 1; 4 * j <= n; j++) {
if (A[i] == '*')
if (A[i] == A[i + j])
if (A[i + j] == A[i + 2 * j])
if (A[i + 2 * j] == A[i + 3 * j])
if (A[i + 3 * j] == A[i + 4 * j]) {
cout << "yes";
return 0;
}
}
}
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, a[500] = {0}, kiek(0);
char c;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> c;
if (c == '*') {
a[i]++;
kiek++;
}
}
if (kiek <= 4) {
cout << "no";
return 0;
}
for (int i = 1; i <= n; i++) {
for (int m = 1; m < 25; m++) {
if (a[i] == 1 && a[i + m] == 1 && a[i + m * 2] == 1 &&
a[i + m * 3] == 1 && a[i + m * 4] == 1) {
cout << "yes";
return 0;
}
}
}
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
char s[10000];
int main() {
int n;
scanf("%d", &n);
scanf("%s", s);
int t, d;
bool succ = false;
for (t = 0; t < n && !succ; ++t) {
for (d = 1; t + 4 * d < n; ++d) {
if (s[t] == '*' && s[t + d] == '*' && s[t + d + d] == '*' &&
s[t + 3 * d] == '*' && s[t + 4 * d] == '*') {
succ = true;
break;
}
}
}
if (succ)
printf("yes\n");
else
printf("no\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int N;
string S;
void solve() {
int i, j, k, l, r, x, y;
string s;
cin >> N >> S;
for (i = 0; i < N; i++)
for (x = 1; x <= N; x++)
if (i + 4 * x < N) {
if (S[i] != '*') continue;
if (S[i + x] != '*') continue;
if (S[i + x * 2] != '*') continue;
if (S[i + x * 3] != '*') continue;
if (S[i + x * 4] != '*') continue;
return (void)printf("yes\n");
}
cout << "no" << endl;
}
int main(int argc, char** argv) {
string s;
int i;
if (argc == 1) ios::sync_with_stdio(false);
for (i = 0; i < argc - 1; i++) s += argv[i + 1], s += '\n';
for (i = 0; i < s.size(); i++) ungetc(s[s.size() - 1 - i], stdin);
solve();
return 0;
}
|
#include <bits/stdc++.h>
#pragma warning(disable : 4786)
#pragma comment(linker, "/STACK:16777216")
using namespace std;
char str[105];
int n;
int main() {
int i, j, k;
while (scanf("%d", &n) != EOF) {
scanf("%s", str);
int len = strlen(str);
int f = 0;
for (i = 0; i < len; i++) {
if (str[i] == '*') {
int d = 0;
for (j = i + 1; j < len; j++) {
d++;
if (str[j] == '*') {
int rr = 1;
for (k = i + d; k < len; k = k + d) {
if (rr == 5) break;
if (str[k] == '*')
rr++;
else
break;
}
if (rr == 5) {
f = 1;
break;
}
}
}
}
if (f == 1) break;
}
if (f == 0)
printf("no\n");
else
printf("yes\n");
}
return 0;
}
|
#include <bits/stdc++.h>
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n >> b) & 1; }
inline void set_bit(int& n, int b) { n |= two(b); }
inline void unset_bit(int& n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) {
int res = 0;
while (n && ++res) n -= n & (-n);
return res;
}
long long int gcd(long long int a, long long int b) {
return (a ? gcd(b % a, a) : b);
}
long long int modPow(long long int a, long long int b, long long int MOD) {
long long int x = 1, y = a;
while (b > 0) {
if (b % 2 == 1) {
x = (x * y) % MOD;
}
b /= 2;
y = (y * y) % MOD;
}
return x;
}
long long int modInverse(long long int a, long long int p) {
return modPow(a, p - 2, p);
}
using namespace std;
string str;
vector<int> v;
map<int, int> mymap;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, i, j, k, diff;
cin >> n;
cin >> str;
for (diff = 1; diff <= n; diff++) {
for (j = 0; j < n; j++) {
long long int ctr = 0;
for (k = j; k < n; k += diff) {
if (str[k] == '.')
break;
else {
ctr++;
if (ctr == 5) {
cout << "yes";
return 0;
}
}
}
}
}
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n;
char s[105];
int main() {
scanf("%d", &n);
scanf("%s", s + 1);
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++) {
int cnt = 0;
for (int k = j; k <= min(n, j + 4 * i) && s[k] == '*'; k += i) cnt++;
if (cnt == 5) {
puts("yes");
return 0;
}
}
puts("no");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
while (cin >> n) {
char scheme[100 + 10] = {};
for (int i = 0; i < n; i++) cin >> scheme[i];
int begin, length, cur = 1;
bool good = false;
for (int i = 0; i < n - 4; i++) {
if (scheme[i] == '*') {
begin = i;
for (int j = 1; j <= n / 4; j++) {
length = j;
int cur0 = 1;
while (scheme[begin + length * cur0] == '*') {
cur++;
if (cur == 5) {
good = true;
break;
}
cur0++;
}
if (good)
break;
else
cur = 1;
}
}
if (good) break;
}
if (good)
cout << "yes" << endl;
else
cout << "no" << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
string s;
int n;
bool in(int x) { return x < n && s[x] == '*'; }
int main() {
cin >> n;
cin >> s;
bool flag = 0;
for (int i = 0; i < n; i++) {
for (int j = 1; j < n; j++) {
if (in(i) && in(i + j) && in(i + 2 * j) && in(i + 3 * j) && in(i + 4 * j))
flag = 1;
}
}
if (flag)
printf("yes\n");
else
printf("no\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char *argv[]) {
ios_base::sync_with_stdio(false);
int n;
string s;
cin >> n >> s;
bool found = false;
for (int i = 0; i < n; ++i) {
if (s[i] == '.') continue;
for (int d = 1; d < n; ++d) {
bool good = true;
for (int j = 0; j < 5; j++) {
int pos = i + d * j;
if (!(pos < n && s[pos] == '*')) good = false;
}
if (good) {
found = true;
cerr << d << endl;
}
}
}
if (found)
cout << "yes" << endl;
else
cout << "no" << endl;
return EXIT_SUCCESS;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int size1;
string s;
vector<int> v;
int arr[200];
cin >> size1 >> s;
for (int i = 0; i < s.size(); i++) {
if (s[i] == '*') v.push_back(i + 1);
}
for (int i = 0; i < v.size(); i++) {
for (int count1 = 1; count1 <= 100; count1++) {
int n = v[i] + count1;
int counttimes = 0;
for (int l = i + 1; l < v.size(); l++) {
if (counttimes == 4) {
cout << "yes";
return 0;
}
if (n == v[l]) {
n = v[l] + count1;
counttimes++;
}
if (v[l] > n) break;
}
if (counttimes == 4) {
cout << "yes";
return 0;
}
}
}
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
char s[1005];
int n;
int main() {
int i, j;
while (~scanf("%d", &n)) {
scanf("%s", s);
if (n < 5) {
printf("no\n");
continue;
}
int m = n / 4;
int flag = 0;
for (i = 1; i <= m; i++) {
for (j = 0; j < n; j++) {
if (s[j] == '*' && s[j + i] == '*' && s[j + 2 * i] == '*' &&
s[j + 3 * i] == '*' && s[j + 4 * i] == '*') {
flag = 1;
break;
}
}
if (flag) break;
}
if (flag)
printf("yes\n");
else
printf("no\n");
}
return 0;
}
|
#include <bits/stdc++.h>
template <class T>
inline bool rd(T &ret) {
char c;
int sgn;
if (c = getchar(), c == EOF) return 0;
while (c != '-' && (c < '0' || c > '9')) c = getchar();
sgn = (c == '-') ? -1 : 1;
ret = (c == '-') ? 0 : (c - '0');
while (c = getchar(), c >= '0' && c <= '9') ret = ret * 10 + (c - '0');
ret *= sgn;
return 1;
}
template <class T>
inline void pt(T x) {
if (x < 0) {
putchar('-');
x = -x;
}
if (x > 9) pt(x / 10);
putchar(x % 10 + '0');
}
using namespace std;
const int NNN = 100;
char a[105];
int hehe;
int main() {
int n;
scanf("%d%s", &n, a);
bool flag = false;
for (int i = 0; i < n && !flag; i++) {
if (a[i] == '*') {
for (int j = 1; j < n; j++) {
if (i + j * 4 > n) break;
if (a[i + j] == '*' && a[i + j * 2] == '*' && a[i + j * 3] == '*' &&
a[i + j * 4] == '*') {
flag = true;
break;
}
}
}
}
if (flag)
puts("yes");
else
puts("no");
return 0;
}
|
#include <bits/stdc++.h>
int N;
char P[128];
int main() {
scanf("%d %s", &N, P);
for (int i = 0; i < N; ++i) {
if (P[i] == '.') continue;
for (int j = 1; i + j * 4 < N; ++j) {
if (P[i + j] == '*' && P[i + j + j] == '*' && P[i + j * 3] == '*' &&
P[i + j * 4] == '*') {
puts("yes");
return 0;
}
}
}
puts("no");
}
|
#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
const int maxn = (int)1e5 + 10;
const int mod = (int)1e9 + 7;
int dx[] = {0, 0, 1, -1, 1, -1, 1, -1};
int dy[] = {1, -1, 0, 0, 1, -1, -1, 1};
long long a, b, c, d, i, j, k, l, t, n, m, p, cs, kk, q, r, s;
char h[1000], o;
double e, f, g;
vector<long long> u, v, w;
vector<pair<long long, long long> > pv;
pair<long long, long long> pp;
string x, y, z;
map<string, long long> mm;
int main() {
while (cin >> a >> x) {
b = 0;
for (i = 0; i < (a - 4); i++) {
for (j = 1; j < 25; j++) {
b = 0;
k = i;
while (k < a) {
if (x[k] == '*')
b++;
else
break;
if (b == 5) {
goto pp;
}
k += j;
}
}
}
pp:
if (b == 5)
printf("YES\n");
else
printf("NO\n");
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
bool isGood = false;
cin >> n;
vector<char> level(n);
for (int i = 0; i < n; i++) {
cin >> level[i];
}
for (int i = 1; i <= n / 4 && !isGood; i++) {
for (int j = 0; j <= n - (4 * i) + (i - 1) && !isGood; j++) {
int sequence = 0;
for (int k = j; k < n && !isGood; k += i) {
if (level[k] == '*')
sequence++;
else {
if (sequence >= 5) isGood = true;
sequence = 0;
}
if (sequence >= 5) isGood = true;
}
}
}
if (isGood)
cout << "yes" << endl;
else
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n;
string s;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> n >> s;
for (int(i) = (1); (i) <= (n - 1); i++) {
int cnt = 0;
for (int(j) = 0; (j) < (n); j++) {
int v = j;
cnt = 0;
while (v < n) {
if (s[v] == '.' || cnt >= 4) break;
v += i;
if (v < n && s[v] == '*') ++cnt;
}
if (cnt == 4) break;
}
if (cnt == 4) {
cout << "yes" << '\n';
return 0;
}
}
cout << "no" << '\n';
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
char c[111];
int n;
bool f(int x) {
if (x >= n)
return false;
else if (c[x] == '.')
return false;
else
return true;
}
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
cin >> c[i];
}
for (int l = 1; l < n; l++) {
for (int i = 0; i < n; i++) {
if (f(i) && f(i + l) && f(i + l + l) && f(i + l + l + l) &&
f(i + l + l + l + l)) {
cout << "yes";
exit(0);
}
}
}
cout << "no";
}
|
#include <bits/stdc++.h>
using namespace std;
void solve() {
int n;
cin >> n;
string s;
cin >> s;
bool ans = false;
for (int i = 1; i <= n; ++i)
for (int start = 0; start < n; ++start) {
int jump = 0;
int cur = start;
while (cur < n && s[cur] == '*') {
jump += 1;
cur += i;
}
if (jump >= 5) ans = true;
}
if (ans)
cout << "yes" << endl;
else
cout << "no" << endl;
}
int main() {
solve();
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n;
string s;
int main() {
cin >> n;
cin >> s;
for (int i = 0; i < s.size(); i++) {
if (s[i] == '*') {
for (char j = 1; j <= s.size(); j++) {
if (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;
cin >> n;
string str;
cin >> str;
int count = 0, flag = 0;
for (int i = 0; i < str.length(); i++) {
if (str[i] == '*') {
for (int j = 1; j < str.length(); j++) {
count = 0;
for (int k = 1; k < 5; k++) {
if ((i + j * k) > str.length() - 1) break;
if (str[i + j * k] == '.') break;
if (str[i + j * k] == '*') count++;
if (count == 4) {
flag = 1;
break;
}
}
if (flag == 1) break;
}
}
if (flag == 1) break;
}
if (flag == 1)
cout << "yes\n";
else
cout << "no\n";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double eps = 1e-10;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
const double pi = acos(-1.0);
const int MAX_INT = (1 << 30);
const ll MAX_LL = (1LL << 62);
class UnluckyNumbers {
public:
};
char arr[200] = {0};
int main() {
int n;
cin >> n;
cin >> arr;
int nStep = n / 2;
for (int step = 1; step < nStep; step++) {
for (int i = 0; i < n; i++) {
if (arr[i] == '*' && arr[i + step] == '*' && arr[i + 2 * step] == '*' &&
arr[i + 3 * step] == '*' && arr[i + 4 * step] == '*') {
cout << "yes";
return 0;
}
}
}
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
int main() {
static char s[100 + 1];
int n, i, l, x, yes;
scanf("%d%s", &n, s);
for (i = 0; i < n; i++)
for (l = 1; i + l * 4 < n; l++) {
yes = 1;
for (x = i; x <= i + (l * 4); x += l)
if (s[x] != '*') {
yes = 0;
break;
}
if (yes) {
printf("yes\n");
return 0;
}
}
printf("no\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
int n;
cin >> n;
string s;
cin >> s;
bool yes = false;
for (int i = 0; i < n; i++)
for (int st = 1; st < n; st++)
if (s[i] == '*') {
int len = 1;
int d = i;
while (d + st < s.length() && s[d + st] == '*') {
d += st;
len++;
}
if (len > 4) {
}
if (len > 4) yes = true;
}
cout << ((yes) ? "yes\n" : "no\n");
cin.get();
cin.get();
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long n, i, j;
string s;
cin >> n >> s;
for (i = 1; i < n; i++) {
for (j = 0; j < n - 4 * i; j++)
if (s[j] == '*' && s[j + i] == '*' && 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;
int main() {
int n;
scanf("%d", &n);
string s;
cin >> s;
bool flag = false;
for (int i = 0; i < s.size(); i++) {
if (s[i] == '.') continue;
for (int j = 1; j < s.size(); j++) {
bool isB = false;
for (int k = 1; k <= 4; k++) {
if (i + j * k >= s.size()) {
isB = true;
break;
}
if (s[i + j * k] == '.') {
isB = true;
break;
}
}
if (!isB) {
flag = true;
break;
}
}
if (flag) break;
}
if (flag)
cout << "yes";
else
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
string s;
cin >> n >> s;
for (int d = 1; d < n; d++)
for (int i = 0; i + 4 * d < n; i++)
if (s[i] == '*' && s[i] == s[i + d] && s[i] == s[i + 3 * d] &&
s[i] == s[i + 4 * d] && s[i] == s[i + 2 * d]) {
cout << "yes";
return 0;
}
cout << "no";
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++) {
for (int d = 1; d < n; d++) {
int c = 0;
for (int j = 0; j < 5; j++) {
if (i + j * d < n && s[i + j * d] == '*') c++;
}
if (c == 5) {
cout << "yes\n";
return 0;
}
}
}
cout << "no\n";
}
|
#include <bits/stdc++.h>
using namespace std;
char s[105];
int main() {
int n;
scanf("%d %s ", &n, s);
for (int delta = 1; delta <= n; ++delta)
for (int i = 0; i < n; ++i)
if (s[i] == '*' && i + 4 * delta < n) {
bool can = 1;
for (int j = 1; j <= 4; ++j)
if (s[i + j * delta] != '*') can = 0;
if (can) {
puts("yes");
return 0;
}
}
puts("no");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, i, j, k, flag = 0;
string level;
cin >> n >> level;
for (i = 0; i < n; i++) {
for (j = 1; i + 4 * j < n; j++) {
for (k = 0; k < 5; k++) {
if (level[i + j * k] == '.') break;
}
if (k == 5) {
flag = 1;
}
}
}
if (flag) {
cout << "yes\n";
} else {
cout << "no\n";
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string s;
cin >> s;
int count = 0;
for (int d = n / 4; d > 0; --d) {
for (int i = 0; i < n; ++i) {
count = 0;
if (s[i] == '*') {
for (int j = i; j < n; j += d) {
if (s[j] != '*') break;
++count;
}
if (count == 5) break;
}
if (count == 5) break;
}
if (count == 5) break;
}
switch (count) {
case 5:
cout << "yes" << endl;
break;
default:
cout << "no" << endl;
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int len;
cin >> len;
string save;
cin >> save;
int counter = 0;
for (int i = 0; i < len; i++) {
if (save[i] == '*') {
int counter = 0;
for (int j = 1; j < 26; j++) {
if (save[i + j] == '*') {
counter++;
for (int k = i + j + j; k < len; k += j) {
if (save[k] == '*') {
counter++;
} else {
counter = 0;
break;
}
if (counter > 3) {
cout << "yes\n";
return 0;
}
}
}
counter = 0;
}
}
}
cout << "no\n";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
scanf("%d", &n);
char s[200];
memset(s, '.', sizeof(s));
scanf("%s", &s);
for (int i = 0; i < n - 4; i++) {
if (s[i] == '*') {
for (int j = 1; n > i + j * 4; j++) {
if (s[i + j] == '*' && s[i + (j << 1)] == '*' &&
s[i + (j * 3)] == '*' && s[i + (j << 2)] == '*') {
printf("yes");
return 0;
}
}
}
}
printf("no");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int M = 1000;
char in[M];
int main() {
int n;
bool mk = 0;
cin >> n;
for (int i = 0; i < n; i++) cin >> in[i];
for (int i = 0; i < n; i++)
if (in[i] == '*')
for (int j = i + 1; j < i + (n - i) / 4 + 1; j++) {
if (in[j] == '*' && in[j * 2 - i] == '*' && in[j * 3 - 2 * i] == '*' &&
in[j * 4 - 3 * i] == '*') {
cout << "yes";
return 0;
}
if (in[j] == '*')
cerr << in[i] << ' ' << in[j] << ' ' << in[j * 2 - i] << ' '
<< in[j * 3 - 2 * i] << ' ' << in[j * 4 - 3 * i] << '\n';
cerr << i << '\t' << j << '\t';
}
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s >> s;
for (int i = 1; i < s.length() / 4 + 1; ++i) {
for (int j = 0; j < s.length() - i * 4; ++j) {
int count = 0;
for (int k = j; k < s.length(); k += i) {
if (s[k] == '*') {
++count;
if (count > 4) {
cout << "yes" << endl;
return 0;
}
} else
count = 0;
}
}
}
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
char a[111];
int n;
scanf("%d", &n);
scanf("%s", a);
int sign = 0;
int s;
for (s = 0; a[s] == '.'; s++)
;
for (int i = s; i < n; i++) {
for (int j = 1; j < n - s - 1; j++) {
if (j * 4 + i >= n) continue;
if (a[i] == '*' && a[i + j] == '*' && a[i + 2 * j] == '*' &&
a[i + 3 * j] == '*' && a[i + 4 * j] == '*') {
sign = 1;
break;
}
}
if (sign) break;
}
if (sign)
printf("yes\n");
else
printf("no\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long i, j, n, c, k, l1, l2;
string s;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin >> n;
cin.ignore();
cin >> s;
for (i = 0; i < s.size(); i++) {
if (s[i] == '*') {
for (k = 1; k <= s.size() / 4; k++) {
l2 = 1;
c = 0;
while (i + k < s.size()) {
if (s[i + l2 * k] == '*') {
c++;
l2++;
} else
break;
if (c == 4) {
l1 = 1;
break;
}
}
if (l1 == 1) break;
}
}
if (l1 == 1) break;
}
if (l1 == 1)
cout << "yes";
else
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string s;
cin >> s;
bool neg = false;
for (int i = 1; i <= n / 4 && !neg; i++) {
for (int k = 0; k <= n - 1 - 4 * i; k++)
if (s[k] == '*' && s[k + i] == '*' && s[k + 2 * i] == '*' &&
s[k + 3 * i] == '*' && s[k + 4 * i] == '*')
neg = true;
}
if (neg)
cout << "yes";
else
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int maxn = 110;
char s[maxn];
int main() {
int n;
while (scanf("%d", &n) != EOF) {
scanf("%s", s);
int f = 0;
for (int i = 1; i < n; ++i) {
for (int j = 0; j < n - 4 * i; ++j) {
int flag = 0;
for (int k = 0; k < 5; ++k) {
if (s[j + k * i] == '.') {
flag = 1;
break;
}
}
if (flag == 0) {
f = 1;
break;
}
}
}
if (f) {
printf("yes\n");
} else {
printf("no\n");
}
}
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int n;
while (scanf("%d", &n) != EOF) {
char ch[110] = {'\0'};
scanf("%s", ch);
int i, j, k, sign = 0, pos;
for (i = 0; i < n && !sign; i++) {
for (j = 1; j < n && !sign; j++) {
pos = i;
for (k = 0; k < 5; k++) {
if (ch[pos] != '*' || pos > n) break;
pos += j;
}
if (k == 5) sign = 1;
}
}
if (sign)
printf("yes\n");
else
printf("no\n");
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int MN = 210;
const int INF = (1 << 30);
int n;
char s[MN];
int main() {
scanf("%d %s", &n, s);
for (int k = 1; k < n; k++) {
for (int i = 0; i < n; i++) {
bool flag = false;
for (int j = 0; j < 5; j++) {
if (i + k * j >= n || s[i + k * j] == '.') {
flag = true;
}
}
if (!flag) {
printf("yes\n");
return 0;
}
}
}
printf("no\n");
return 0;
}
|
#include <bits/stdc++.h>
const double eps = 1e-19;
const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const int MAXN = 100005;
using namespace std;
int n;
char str[MAXN];
int main() {
cin >> n >> str;
for (int i = 1; i < n; i++) {
for (int j = 0; j < n; j++) {
bool ok = true;
for (int k = 0; k < 5; k++) {
if (j + k * i >= n || str[j + k * i] == '.') {
ok = false;
}
}
if (ok) {
printf("yes\n");
return 0;
}
}
}
printf("no\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n, i, j, ok, v[500];
string s;
void verifica(int start, int pas) {
int steps = 0;
int oktura = 1;
while (steps < 4) {
start = start + pas;
if (v[start] == 0) oktura = 0;
steps++;
}
if (oktura) ok = 1;
}
int main() {
cin >> n;
cin >> s;
for (i = 1; i <= n; i++) {
if (s[i - 1] == '*')
v[i] = 1;
else
v[i] = 0;
}
ok = 0;
for (i = 1; i <= n / 2 and ok == 0; i++) {
for (j = 1; j <= n; j++) {
if (v[j] == 1) verifica(j, i);
}
}
if (ok)
cout << "yes";
else
cout << "no";
}
|
#include <bits/stdc++.h>
using namespace std;
int n;
char a[102];
int main() {
FILE *fout = fopen("preface.out", "w");
int b, i, j, k;
scanf("%d", &n);
int sum, flag = 0;
scanf("%s", a);
for (int diff = 1; diff <= n / 4; diff++) {
for (i = 0; i < n; i++) {
sum = 5;
flag = 0;
for (j = i; j < n; j += diff) {
if (a[j] == '*')
sum--;
else
break;
}
if (sum <= 0) {
flag = 1;
}
if (flag == 1) break;
}
if (flag == 1) break;
}
if (flag == 1)
printf("yes\n");
else
printf("no\n");
return (0);
}
|
#include <bits/stdc++.h>
using namespace std;
string s;
int n;
int main() {
ios_base::sync_with_stdio(false);
cin >> n >> s;
for (long long i = 0; i < n; i++) {
if (s[i] == '*')
for (long long t = 1; t <= n - 1; t++) {
bool check = true;
for (long long j = 0; j < 5; j++)
if (i + j * t >= n || s[i + j * t] == '.') check = false;
if (check == 1) {
cout << "yes";
return 0;
}
}
}
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
char s[100];
scanf("%d %s", &n, &s);
for (int i = 0; i < n; i++)
for (int j = 1; j <= 100; j++) {
int t = 0;
for (int k = i; k < n && t < 5 && s[k] == '*'; t++, k += j)
;
if (t == 5) {
printf("yes");
return 0;
}
}
printf("no");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
int n, f = 0;
cin >> n;
string s;
cin >> s;
for (int i = 0; i <= n - 1; i++) {
if (s[i] == '*') {
for (int j = 1; j <= n; j++) {
int c = 0;
for (int k = i; k < n; k += j) {
if (s[k] == '*') {
c++;
if (c >= 5) f = 1;
} else
break;
}
}
}
}
if (f)
cout << "yes";
else
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n;
string s;
int main() {
cin >> n;
cin >> s;
int res = 0;
bool r = false;
for (int i = 1; i < 26; ++i) {
for (int st = 0; st < n; ++st) {
res = 0;
for (int j = 0; j < 5 * i && st + j < n; j += i) {
if (s[st + j] == '*') {
++res;
}
}
if (res == 5) {
r = true;
}
}
}
if (r) {
cout << "yes";
} else {
cout << "no";
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
char str[1005];
int ok = 0;
int main() {
int n;
scanf("%d", &n);
scanf("%s", &str[1]);
for (int i = 1; i < n; i++) {
if (str[i] == '*')
for (int j = 1; j <= 100; j++) {
if (i + 4 * j <= n && str[i + j] == '*' && str[i + 2 * j] == '*' &&
str[i + 3 * j] == '*' && str[i + 4 * j] == '*') {
ok = 1;
break;
}
}
if (ok) break;
}
if (ok)
printf("yes\n");
else
puts("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++)
if (s[i] == '*')
for (int j = i + 1; j + 3 * (j - i) < n; j++)
if (s[j] == '*' && s[j + (j - i)] == '*' && s[j + 2 * (j - i)] == '*' &&
s[j + 3 * (j - i)] == '*') {
cout << "YES" << endl;
return 0;
}
cout << "NO" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long pw(long long b, long long p) {
if (!p) return 1;
long long sq = pw(b, p / 2);
sq *= sq;
if (p % 2) sq *= b;
return sq;
}
long long sq(long long x) {
for (int i = 0; i < x; i++)
if ((long long)i * i > x) return (i - 1);
return 1;
}
long long gcd(long long a, long long b) { return (b == 0 ? a : gcd(b, a % b)); }
int sd(long long x) { return x < 10 ? x : x % 10 + sd(x / 10); }
long long lcm(long long a, long long b) { return ((a * b) / gcd(a, b)); }
int main() {
int n;
scanf("%d", &n);
string x;
cin >> x;
for (int i = 1; i < n; i++) {
for (int j = 0; j < n; j++) {
int cnt = 0;
for (int k = j, c = 0; k < n && c <= 4; k += i, c++) {
if (x[k] == '*') cnt++;
}
if (cnt == 5) {
cout << "yes";
return 0;
}
}
}
cout << "no";
}
|
#include <bits/stdc++.h>
using namespace std;
char a[105];
int n, k;
int scheck(int diff, int j) {
int i, ctr = 2;
for (i = j + diff; i < n; i += diff) {
if (a[i] == '*') {
ctr++;
if (ctr == 5) return 1;
} else
return 0;
}
}
int main() {
cin >> n;
cin >> a;
int i, j, diff = 0;
for (i = 0; i < n; i++) {
if (a[i] == '*') {
k = i;
for (j = k + 1; j < n; j++) {
if (a[j] == '*') {
diff = j - i;
int f = scheck(diff, j);
if (f == 1) {
cout << "yes";
return 0;
}
}
}
}
}
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int n;
char N[101] = {0};
int i, j, k;
int count = 0;
int check = 0;
int a;
scanf("%d ", &n);
gets(N);
for (i = 0; i < n; i++) {
if (N[i] == '*') count++;
}
if (count >= 4) {
for (j = 1; j <= n / 4; j++) {
for (i = 0; (i + j * 4) < n; i++) {
if (N[i] == '*') {
count = 0;
if ((N[i] == N[i + j * 1]) && (N[i] == N[i + j * 2]) &&
(N[i] == N[i + j * 3]) && (N[i] == N[i + j * 4])) {
printf("yes");
return 0;
}
}
}
}
}
printf("no");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
scanf("%d\n", &n);
string s;
getline(cin, s);
bool b = false;
vector<int> v;
for (int i = 0; i < s.size(); i++) {
if (s[i] == '*') v.push_back(i);
}
for (int i = 0; i < v.size(); i++) {
int c = 1;
int a = v[i];
while (a + c < s.size()) {
int c2 = a;
int c3 = 0;
while (c2 < s.size()) {
c2 += c;
if (c2 >= s.size() || s[c2] == '.') break;
c3++;
}
if (c3 >= 4) {
b = true;
break;
}
c++;
}
if (b) break;
}
if (b)
printf("yes\n");
else
printf("no\n");
return 0;
}
|
#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1000000000")
using namespace std;
int n;
string s;
int main() {
cin >> n;
cin >> s;
int st = 0;
int len = n / 4;
int ok;
for (int(i) = (0); (i) < int(n); ++(i)) {
for (int(j) = (1); (j) < int(len + 1); ++(j)) {
int cnt = 0;
if (i < n && s[i] == '*') cnt++;
if (i + j < n && s[i + j] == '*') cnt++;
if (i + 2 * j < n && s[i + 2 * j] == '*') cnt++;
if (i + 3 * j < n && s[i + 3 * j] == '*') cnt++;
if (i + 4 * j < n && s[i + 4 * j] == '*') cnt++;
if (cnt == 5) {
cout << "yes" << endl;
return 0;
}
}
}
cout << "no" << endl;
cin.sync();
cin.get();
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int N;
cin >> N;
cin.ignore(1, '\n');
string level;
cin >> level;
bool possible = false;
for (int jlen = 1; jlen <= N; jlen++) {
for (int start = 0; start < N; start++) {
if (level[start] == '*') {
int p = 1;
int current = start;
while (current + jlen < N && level[current + jlen] == '*') {
current += jlen;
p++;
}
if (p >= 5) {
possible = true;
break;
}
}
}
if (possible) break;
}
if (possible)
cout << "yes\n";
else
cout << "no\n";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
string s;
cin >> n >> s;
bool b = 0;
for (int i = 1; i < 101; ++i)
for (int j = 0; j < n; ++j) {
int g = 0;
for (int t = j; t < n && s[t] == '*'; t += i, ++g)
;
b |= (g >= 5);
}
cout << (b ? "yes" : "no") << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int n;
char level[1001];
int MakeJumps(int x, int len) {
if (level[x] != '*') return 0;
int ans = 0;
x += len;
if (x > n) return 0;
while (level[x] == '*') {
ans++;
x += len;
if (x > n) break;
}
return ans;
}
int main() {
int i, j;
int jumps;
scanf("%d", &n);
scanf("%s", level + 1);
for (i = 1; i <= n; i++) {
for (j = 1; j <= n; j++) {
jumps = MakeJumps(j, i);
if (jumps >= 4) {
printf("yes\n");
return 0;
}
}
}
printf("no\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
template <typename T>
T chmin(T &a, T b) {
return a = min(a, b);
}
template <typename T>
T chmax(T &a, T b) {
return a = max(a, b);
}
char str[2048];
int n;
bool check(int a, int b) {
for (int i = a; i <= a + b * 4; i += b) {
if (i >= n) return false;
if (str[i] != '*') return false;
}
return true;
}
int main() {
scanf("%d", &n);
scanf("%s", str);
bool ans = false;
for (int i = 0; i < n; i++)
for (int j = 1; j < n; j++) ans |= check(i, j);
if (ans)
printf("yes\n");
else
printf("no\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long n;
cin >> n;
string s;
cin >> s;
for (long long ini = 0; ini < n; ini++) {
for (long long salto = 1; salto < n; salto++) {
bool ok = true;
for (long long cnt = 0; cnt < 5; cnt++) {
long long pos = ini + salto * cnt;
if (pos >= n || s[pos] == '.') {
ok = false;
break;
}
}
if (ok) {
cout << "yes" << endl;
return 0;
}
}
}
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
char s[5 * 100 + 1];
int main() {
int beg, step, n;
bool res = false;
scanf("%d", &n);
scanf("%s", s);
for (beg = n; beg < 5 * n; beg++) s[beg] = '.';
for (beg = 0; beg < n; beg++)
for (step = 1; step < n; step++)
if (s[beg] == '*' && s[beg + step] == '*' && s[beg + 2 * step] == '*' &&
s[beg + 3 * step] == '*' && s[beg + 4 * step] == '*')
res = true;
if (res)
printf("yes\n");
else
printf("no\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
char a[1000];
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
if (a[j] == '*')
if (a[j + i] == '*')
if (a[j + i * 2] == '*')
if (a[j + i * 3] == '*')
if (a[j + i * 4] == '*') {
cout << "yes" << endl;
return 0;
}
}
}
cout << "no" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
char s[201];
int l;
int main() {
scanf("%d", &l);
scanf("%s", s);
for (int i = 0; i < l; i++) {
for (int j = 1; j < l; j++) {
bool can = 1, gg = 1;
for (int k = 0; k < 5; k++) {
int t = i + k * j;
if (t >= l) {
gg = 0;
break;
}
if (s[t] != '*') can = 0;
}
if (can && gg) {
printf("yes\n");
return 0;
}
}
}
printf("no\n");
return 0;
}
|
#include <bits/stdc++.h>
int n, i;
char st[101];
bool pr() {
bool ret;
for (int j = 1; j < 27; ++j) {
ret = true;
for (int index = i + j; index < i + j * 5; index += j) {
if (st[index] == '.' || index >= n) {
ret = false;
break;
}
}
if (ret) {
return true;
}
}
return false;
}
int main() {
bool tr = false;
std::cin >> n;
std::cin >> st;
for (i = 0; i < n; ++i) {
if (st[i] == '*') {
tr = pr();
}
if (tr == true) {
std::cout << "yes";
break;
}
}
if (i == n && tr == false) {
std::cout << "no";
}
}
|
#include <bits/stdc++.h>
int main() {
int n;
scanf("%d", &n);
char s[101];
scanf("%s", s);
int count = 0;
int i, j, k;
int f = 0;
for (i = 0; i < n; i++)
if (s[i] == '*') {
count = 0;
for (j = 1; j < n; j++) {
count = 0;
for (k = j; k < n - i; k = k + j) {
if (s[i] == s[i + k])
count++;
else
break;
if (count == 4) f = 1;
}
}
}
if (f == 1)
printf("yes\n");
else
printf("no\n");
return 0;
}
|
#include <bits/stdc++.h>
bool vis[111];
using namespace std;
int main() {
int n;
string s;
cin >> n;
cin >> s;
for (int i = 0; i < n; ++i)
if (s[i] == '*') vis[i] = 1;
for (int i = 0; i < n; ++i) {
if (vis[i]) {
for (int j = 1; i + j * 4 < n; ++j) {
if (vis[i + j] && vis[i + j * 2] && vis[i + j * 3] && vis[i + j * 4]) {
puts("yes");
return 0;
}
}
}
}
puts("no");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 1004;
char str[maxn];
int main() {
int n;
scanf("%d", &n);
scanf("%s", str + 1);
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= 100; ++j) {
if (str[i] == '*' && str[i + j] == '*' && str[i + 3 * j] == '*' &&
str[i + 4 * j] == '*' && str[i + 2 * j] == '*') {
cout << "yes" << endl;
return 0;
}
}
}
puts("no");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
char s[200];
int main() {
int i, j, k, n, tmp, b1, b2;
scanf("%d", &n);
scanf("%s", s);
b2 = 0;
for (i = 0; i < n; i++)
if (s[i] == '*')
for (j = i + 1; j < n; j++)
if (s[j] == '*') {
b1 = 1;
for (k = 2; k < 5; k++) {
tmp = (j - i) * k + i;
if ((tmp >= n) || (s[tmp] == '.')) b1 = 0;
}
if (b1 == 1) b2 = 1;
}
if (b2 == 1)
printf("yes\n");
else
printf("no\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n;
string s;
int main() {
cin >> n;
cin >> s;
int m;
for (int i = 0; i < n; i++) {
for (int j = 1; j <= n; j++) {
int c = 0;
for (int k = i; k < n; k += j) {
if (s[k] == '.') break;
if (s[k] == '*') c++;
if (c == 5) {
cout << "yes" << endl;
return 0;
}
}
}
}
cout << "no" << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
const long long llinf = 1e18 + 7;
const double eps = 1e-15;
const int mod = 1e6 + 7;
string s;
int n;
int main() {
ios::sync_with_stdio(false);
cin >> n >> s;
for (int i = 1; i < n; i++)
for (int j = 0; j + 4 * i < n; j++)
if (s[j] == '*' && s[j + i] == '*' && s[j + i * 2] == '*' &&
s[j + i * 3] == '*' && s[j + i * 4] == '*') {
return cout << "yes", 0;
}
return cout << "no", 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
char arr[110] = {NULL};
cin >> arr;
for (int i = 1; i <= n; ++i) {
for (int j = 0; j < n; j++) {
int sz = 0;
for (int k = j; k < n; k += i) {
if (arr[k] == '.') {
break;
} else {
sz++;
if (sz == 5) {
printf("yes\n");
return 0;
}
}
}
}
}
printf("no\n");
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
scanf("%d", &n);
char b[1000];
scanf(" %s", b);
for (int i = (0); i < (n); i++) {
for (int j = (i + 1); j < (n); j++) {
int dv = j - i;
bool bad = false;
for (int k = (0); k < (5); k++) {
if (i + dv * k < n && b[i + dv * k] == '*')
;
else
bad = true;
}
if (!bad) {
printf("yes\n");
return 0;
}
}
}
printf("no\n");
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, i, j, k = 777;
cin >> n;
string s;
cin >> s;
for (i = 1; i < n; i++) {
for (j = 0; j < n - 2; j++) {
if (s[j] == '*' && s[j + i] == '*' && s[j + 2 * i] == '*' &&
s[j + 3 * i] == '*' && s[j + 4 * i] == '*' && j + 4 * i <= n) {
cout << "yes";
k = 1;
break;
}
}
if (k == 1) {
break;
}
}
if (k != 1) {
cout << "no";
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a[105] = {0};
int n;
cin >> n;
string s;
cin >> s;
int i, j;
for (i = 1; i <= n; i++) {
if (s[i - 1] == '*') a[i] = 1;
}
int flag = 0;
int save;
for (i = 1; i <= n; i++) {
if (a[i]) {
for (j = i + 1; j <= n;) {
if (a[j]) {
int d = j - i;
int k = j + d;
int cnt = 0;
flag = 0;
while (a[k] == 1) {
k += d;
cnt++;
}
if (cnt == 3) {
flag = 1;
break;
}
}
j++;
}
}
if (flag) {
break;
}
}
if (flag == 1)
cout << "yes\n";
else
cout << "no\n";
}
|
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000;
char a[maxn];
int main() {
int n;
while (~scanf("%d %s", &n, a)) {
int flag = 0;
for (int k = 1; k < n; k++) {
for (int i = 0; i < n; i++) {
int j, t = 0;
for (int j = i; j < n; j += k) {
if (a[j] == '*')
t++;
else
break;
}
if (t >= 5) {
flag++;
break;
}
}
if (flag) break;
}
if (flag)
cout << "yes" << endl;
else
cout << "no" << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
template <class C>
void mini(C& a4, C b4) {
a4 = min(a4, b4);
}
template <class C>
void maxi(C& a4, C b4) {
a4 = max(a4, b4);
}
template <class T1, class T2>
ostream& operator<<(ostream& out, pair<T1, T2> pair) {
return out << "(" << pair.first << ", " << pair.second << ")";
}
template <class A, class B, class C>
struct Triple {
A first;
B second;
C third;
};
template <class T>
void ResizeVec(T&, vector<long long>) {}
template <class T>
void ResizeVec(vector<T>& vec, vector<long long> sz) {
vec.resize(sz[0]);
sz.erase(sz.begin());
if (sz.empty()) {
return;
}
for (T& v : vec) {
ResizeVec(v, sz);
}
}
int main() {
ios_base::sync_with_stdio(0);
cout << fixed << setprecision(10);
double beg_clock = 1.0 * clock() / CLOCKS_PER_SEC;
long long n;
cin >> n;
;
string s;
cin >> s;
;
s = ' ' + s;
for (long long i = (1); i <= (n); ++i) {
for (long long j = (i + 1); j <= (n); ++j) {
vector<long long> cands{i, j};
for (long long tr = 0; tr < (3); ++tr) {
cands.push_back(cands.back() + j - i);
}
long long bad = 0;
for (auto x : cands) {
if (x > n || s[x] == '.') {
bad = 1;
}
}
if (!bad) {
cout << "yes\n";
return 0;
}
}
}
cout << "no\n";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, a[100];
scanf("%d", &n);
string s;
cin >> s;
for (int i = 0; i < 26; ++i) {
for (int j = 0; j < s.size(); ++j) {
a[j] = 0;
}
for (int j = 0; j < s.size(); ++j) {
if (s[j] != '.')
if (j - i >= 0)
a[j] = a[j - i] + 1;
else
a[j] = 1;
if (a[j] > 4) {
printf("yes");
return 0;
}
}
}
printf("no");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
cin >> n;
string s;
cin >> s;
for (int k = 1; k < n; k++) {
for (int i = 0; i < n - 4 * k; i++)
if (s[i] == '*' && s[i + k] == '*' && s[i + 2 * k] == '*' &&
s[i + 3 * k] == '*' && s[i + 4 * k] == '*') {
cout << "yes";
return 0;
}
}
cout << "no";
}
|
#include <bits/stdc++.h>
using namespace std;
string s;
int n;
int main() {
cin >> n;
cin >> s;
for (int len = 1; len <= n; len++)
for (int pos = 0; pos < n; pos++) {
if (pos + len * 4 >= n) continue;
if (s[pos] == '*' && s[pos + len] == '*' && s[pos + len * 2] == '*' &&
s[pos + len * 3] == '*' && s[pos + len * 4] == '*') {
cout << "yes\n";
return 0;
}
}
cout << "no\n";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
string s;
cin >> n >> s;
for (int i = 0; i < n; ++i)
for (int interval = 1; interval <= n; ++interval) {
int cnt = 0, cur = i;
while (cur < n && s[cur] == '*') ++cnt, cur = cur + interval;
if (cnt >= 5) goto END;
}
cout << "no";
return 0;
END:
cout << "yes";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
static const int N = 100;
char s[N + 1];
bool funk(int pos, int val) {
for (int i = 0; i < 5; i++) {
if (s[pos] == '.') return 0;
pos += val;
}
return 1;
}
int main() {
int n;
scanf("%i", &n);
scanf("%s", &s);
for (int i = 1; 4 * i <= n; i++) {
for (int j = 0; j + 4 * i < n; j++) {
if (funk(j, i)) {
printf("yes\n");
return 0;
}
}
}
printf("no\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-9;
const double PI = acos(-1.0);
const int MOD = 1000 * 1000 * 1000 + 7;
const int INF = 2000 * 1000 * 1000;
const int MAXN = 110;
template <typename T>
inline T sqr(T n) {
return n * n;
}
int n;
char s[MAXN];
bool ans;
int main() {
scanf("%d\n", &n);
gets(s);
for (int len = 1; len <= n; len++) {
for (int i = 0; i < n; i++) {
int pos = i;
bool found = true;
for (int num = 0; num < 5 && found; num++) {
if (pos >= n || s[pos] != '*') {
found = false;
}
pos += len;
}
if (found) {
ans = true;
}
}
}
if (ans) {
puts("yes");
} else {
puts("no");
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
char a[101];
cin >> a;
for (int i = 1; i < 25; i++) {
for (int j = 0; j < n; j++) {
if (a[j] == '*' && a[j + i] == '*' && a[j + (2 * i)] == '*' &&
a[j + (3 * i)] == '*' && a[j + (4 * i)] == '*') {
cout << "yes";
return 0;
}
}
}
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int n, d = 0, a, i, f = 0;
scanf("%d", &n);
char s[n + 1];
scanf("%s", s);
for (d = 1; d < n; d++) {
for (a = 0; a < n; a++) {
if (a + 4 * d < n) {
for (i = 0; i < 5; i++) {
if (s[a + i * d] == '.') {
break;
}
if (i == 4) {
f = 1;
d = n;
break;
}
}
}
}
}
if (f == 1) {
printf("yes\n");
} else {
printf("no\n");
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
string str;
bool arr[123];
int main() {
int n;
cin >> n >> str;
for (int i = 0; i < n; i++)
if (str[i] == '*') arr[i + 1] = 1;
for (int i = 1; i <= n; i++) {
if (arr[i]) {
int c = 0;
for (int J = 1; J <= n; J++) {
c = 0;
int k = i;
while (arr[k]) {
c++;
if (c == 5) {
cout << "yes";
return 0;
}
k += J;
}
}
}
}
cout << "no";
}
|
#include <bits/stdc++.h>
using namespace std;
int n, l, i;
string s;
int main() {
cin >> n >> s;
for (i = 0; i < n; ++i) {
for (l = 1; i + 4 * l < n; ++l)
if (s[i] == '*' && s[i + l] == '*' && s[i + 2 * l] == '*' &&
s[i + 3 * l] == '*' && s[i + 4 * l] == '*') {
cout << "yes" << endl;
return 0;
}
}
cout << "no" << endl;
}
|
#include <bits/stdc++.h>
char s[105];
int main() {
int n;
scanf("%d", &n);
scanf("%s", s);
for (int ss = 1; ss < n; ss++)
for (int i = 0; i + 3 * ss < n; i++) {
if (s[i] == '*' && s[i + ss] == '*' && s[i + ss + ss] == '*' &&
s[i + ss + ss + ss] == '*' && s[i + ss + ss + ss + ss] == '*') {
printf("yes\n");
return 0;
}
}
printf("no\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int INF = (int)1e9 + 7;
const int MXN = (int)1e6 + 10;
const double EPS = (double)1e-9;
char s[10001];
int n;
bool boo;
int main() {
scanf("%d\n%s", &n, &s);
for (int i = 0; i < n; ++i) {
for (int j = 1; i + 4 * j < n; ++j) {
boo = true;
for (int k = 0; k < 5; ++k) {
if (s[i + k * j] == '.') {
boo = false;
break;
}
}
if (boo) {
printf("yes");
return 0;
}
}
}
printf("no");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, cnt, c, sz;
cin >> n;
string s;
cin >> s;
for (int i = 0; i < n; i++) {
if (s[i] == '*')
for (int j = i + 1; j < n; j++) {
if (s[j] == '*') {
cnt = 3;
c = j - i;
for (int k = j + c; k < n; k += c) {
if (s[k] == '*') {
cnt--;
} else
break;
if (cnt == 0) {
cout << "yes" << endl;
return 0;
}
}
}
}
}
cout << "no" << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
char str[111];
int main() {
int n;
scanf("%d", &n);
scanf("%s", str);
int gh = n / 4;
for (int i = 1; i <= gh; i++) {
for (int j = 0; j < n; j++) {
if (str[j] == '*') {
if (str[j + i] == '*' and str[j + 2 * i] == '*' and
str[j + 3 * i] == '*' and str[j + 4 * i] == '*') {
puts("YES");
return 0;
}
}
}
}
puts("NO");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
double pi = 3.141592653589793238462;
string uni = "abcdefghijklmnopqrstuvwxyz";
long long int check(long long int n) {
long long int ctr = 0;
while (n > 0) {
n /= 5;
ctr += n;
}
return ctr;
}
signed main() {
long long int n;
cin >> n;
string s;
cin >> s;
for (long long int i = 1; i < n; i++) {
for (long long int j = 0; j < n - 4 * i; j++) {
if (s[j] == 42 && s[j + i] == 42 && s[j + 2 * i] == 42 &&
s[j + 3 * i] == 42 && s[j + i * 4] == 42) {
cout << "yes";
return 0;
}
}
}
cout << "no";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
bool check(string s, int step, int stat) {
for (int i = 1; i <= 5; i++) {
if (stat >= s.length()) return false;
if (s[stat] != '*') return false;
stat += step;
}
return true;
}
int main() {
int n;
string s;
cin >> n >> s;
for (int i = 1; i < 100; i++) {
for (int j = 0; j < s.length(); j++) {
if (check(s, i, j)) {
printf("yes\n");
return 0;
}
}
}
printf("no\n");
return 0;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.