#include <cstdio> char ans[] = "biko"; char input[800008]; int count; int main() { int n; scanf("%d", &n); scanf("%s", input); for (int i = 0; i < 8 * n; ++i) if (input[i] == '1') count++; if (count < 3 * n || 6 * n < count) printf("NIE\n"); else { int min_bit = count / n; int excess_bit = count % n; for (int i = 0; i < n - excess_bit; ++i) printf("%c", ans[min_bit - 3]); for (int i = 0; i < excess_bit; ++i) printf("%c", ans[min_bit - 2]); 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 | #include <cstdio> char ans[] = "biko"; char input[800008]; int count; int main() { int n; scanf("%d", &n); scanf("%s", input); for (int i = 0; i < 8 * n; ++i) if (input[i] == '1') count++; if (count < 3 * n || 6 * n < count) printf("NIE\n"); else { int min_bit = count / n; int excess_bit = count % n; for (int i = 0; i < n - excess_bit; ++i) printf("%c", ans[min_bit - 3]); for (int i = 0; i < excess_bit; ++i) printf("%c", ans[min_bit - 2]); printf("\n"); } return 0; } |