#ifdef _MSC_VER
#ifndef __GNUC__
#pragma warning(disable: 4996)
#endif
#define main main0
#endif
#include <iostream>
#include <string>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(NULL);
int n, dlugosc, wynik = 0;
string str;
cin >> n;
dlugosc = n / 10;
// getline(cin, str);
cin.ignore(10, '\n');
getline(cin, str);
for(string::iterator it = str.begin(), it1; it != str.end(); it = it1) {
bool poprawne = true;
for(it1 = it + dlugosc; it < it1; ++it)
if(*it == 'N') {
poprawne = false;
break;
}
if(poprawne)
++wynik;
}
cout << wynik << endl;
return 0;
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | #ifdef _MSC_VER #ifndef __GNUC__ #pragma warning(disable: 4996) #endif #define main main0 #endif #include <iostream> #include <string> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef unsigned int uint; int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(NULL); int n, dlugosc, wynik = 0; string str; cin >> n; dlugosc = n / 10; // getline(cin, str); cin.ignore(10, '\n'); getline(cin, str); for(string::iterator it = str.begin(), it1; it != str.end(); it = it1) { bool poprawne = true; for(it1 = it + dlugosc; it < it1; ++it) if(*it == 'N') { poprawne = false; break; } if(poprawne) ++wynik; } cout << wynik << endl; return 0; } |
English