#include <cstdio> #include <iostream> #include <string> using namespace std; int $[7]; int main() { *($+3) = 0x61; *($+4) = 0x63; *($+5) = 0x67; *($+6) = 0x6f; int n; string s; scanf("%d", &n); cin >> s; int $1 = 0; for (int i = 0; i < 8 * n; i++) { if (s[i] == '1') $1++; } $1 -= 3 * n; if ($1 < 0 || $1 > 3 * n) { puts("NIE"); return 0; } int d = $1 / 3, m = $1 % 3; for (int i = 0; i < d; i++) printf("%c", *($+6)); if (d < n) printf("%c", *($+m+3)); for (int i = d + 1; i < n; i++) printf("%c", *($+3)); puts(""); }
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 | #include <cstdio> #include <iostream> #include <string> using namespace std; int $[7]; int main() { *($+3) = 0x61; *($+4) = 0x63; *($+5) = 0x67; *($+6) = 0x6f; int n; string s; scanf("%d", &n); cin >> s; int $1 = 0; for (int i = 0; i < 8 * n; i++) { if (s[i] == '1') $1++; } $1 -= 3 * n; if ($1 < 0 || $1 > 3 * n) { puts("NIE"); return 0; } int d = $1 / 3, m = $1 % 3; for (int i = 0; i < d; i++) printf("%c", *($+6)); if (d < n) printf("%c", *($+m+3)); for (int i = d + 1; i < n; i++) printf("%c", *($+3)); puts(""); } |