#include <cstdio>
char s[1000000];
char t[1000000];
int main()
{
int n;
scanf("%d", &n);
scanf("%s", s);
int j = 0;
for (int i = 0; i < 8 * n; i++)
{
if (s[i] == '1')
{
j++;
}
}
if (3 * n == j)
{
for (int i = 0; i < n; i++)
{
t[i] = 'p';
}
printf("%s\n", t);
return 0;
}
if (6 * n == j)
{
for (int i = 0; i < n; i++)
{
t[i] = 'w';
}
printf("%s\n", t);
return 0;
}
int x = 4 * n - j;
int y = j - 3 * n;
if (x >= 0 && x <= n && y >= 0 && y <= n)
{
for (int i = 0; i < x; i++)
{
t[i] = 'p';
}
for (int i = x; i < x + y; i++)
{
t[i] = 'q';
}
printf("%s\n", t);
return 0;
}
x = 5 * n - j;
y = j - 4 * n;
if (x >= 0 && x <= n && y >= 0 && y <= n)
{
for (int i = 0; i < x; i++)
{
t[i] = 'q';
}
for (int i = x; i < x + y; i++)
{
t[i] = 's';
}
printf("%s\n", t);
return 0;
}
x = 6 * n - j;
y = j - 5 * n;
if (x >= 0 && x <= n && y >= 0 && y <= n)
{
for (int i = 0; i < x; i++)
{
t[i] = 's';
}
for (int i = x; i < x + y; i++)
{
t[i] = 'w';
}
printf("%s\n", t);
return 0;
}
printf("NIE\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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | #include <cstdio> char s[1000000]; char t[1000000]; int main() { int n; scanf("%d", &n); scanf("%s", s); int j = 0; for (int i = 0; i < 8 * n; i++) { if (s[i] == '1') { j++; } } if (3 * n == j) { for (int i = 0; i < n; i++) { t[i] = 'p'; } printf("%s\n", t); return 0; } if (6 * n == j) { for (int i = 0; i < n; i++) { t[i] = 'w'; } printf("%s\n", t); return 0; } int x = 4 * n - j; int y = j - 3 * n; if (x >= 0 && x <= n && y >= 0 && y <= n) { for (int i = 0; i < x; i++) { t[i] = 'p'; } for (int i = x; i < x + y; i++) { t[i] = 'q'; } printf("%s\n", t); return 0; } x = 5 * n - j; y = j - 4 * n; if (x >= 0 && x <= n && y >= 0 && y <= n) { for (int i = 0; i < x; i++) { t[i] = 'q'; } for (int i = x; i < x + y; i++) { t[i] = 's'; } printf("%s\n", t); return 0; } x = 6 * n - j; y = j - 5 * n; if (x >= 0 && x <= n && y >= 0 && y <= n) { for (int i = 0; i < x; i++) { t[i] = 's'; } for (int i = x; i < x + y; i++) { t[i] = 'w'; } printf("%s\n", t); return 0; } printf("NIE\n"); return 0; } |
English