//Autor: Bartłomiej Czarkowski
#include <bits/stdc++.h>
using namespace std;
const int N = 1001'000;
const int Z = 10;
int n, m;
char s[N];
char t[Z];
int main() {
scanf("%d%s", &n, s + 1);
for (int i = 1; i <= n * 8; ++i) {
m += s[i] - '0';
}
if (m < 3 * n || 6 * n < m) {
printf("NIE\n");
return 0;
}
t[3] = 'p';
t[4] = 'x';
t[5] = 'z';
t[6] = 'w';
while (n) {
int w = m / n;
printf("%c", t[w]);
--n;
m -= w;
}
printf("\n");
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 | //Autor: Bartłomiej Czarkowski #include <bits/stdc++.h> using namespace std; const int N = 1001'000; const int Z = 10; int n, m; char s[N]; char t[Z]; int main() { scanf("%d%s", &n, s + 1); for (int i = 1; i <= n * 8; ++i) { m += s[i] - '0'; } if (m < 3 * n || 6 * n < m) { printf("NIE\n"); return 0; } t[3] = 'p'; t[4] = 'x'; t[5] = 'z'; t[6] = 'w'; while (n) { int w = m / n; printf("%c", t[w]); --n; m -= w; } printf("\n"); return 0; } |
English