#include <cstdio>
#include <iostream>
int main() {
int n;
scanf("%d", &n);
char* tab = "000acgo";
int bits = 0;
char c;
while (scanf("%c", &c) == 1)
if (c == '1') ++bits;
if ((bits < (n * 3)) || ((n * 6) < bits)) {
puts("NIE");
return 0;
}
while (bits > 0) {
int q = bits / n;
printf("%c", tab[q]);
bits -= q;
n -= 1;
}
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 | #include <cstdio> #include <iostream> int main() { int n; scanf("%d", &n); char* tab = "000acgo"; int bits = 0; char c; while (scanf("%c", &c) == 1) if (c == '1') ++bits; if ((bits < (n * 3)) || ((n * 6) < bits)) { puts("NIE"); return 0; } while (bits > 0) { int q = bits / n; printf("%c", tab[q]); bits -= q; n -= 1; } printf("\n"); return 0; } |
English