#include <cstdio>
#include <cassert>
#include <algorithm>
#include <vector>
using namespace std;
int n, k;
char t[9];
int main()
{
int i;
t[3] = 'a';
t[4] = 'e';
t[5] = 'u';
t[6] = 'o';
scanf("%d\n", &n);
k = 0;
for(i = 0; i < 8*n; ++i) {
char a;
scanf("%c", &a);
if (a == '1') {
k++;
}
}
if (n*3 > k || k > n*6) {
printf("NIE\n");
return 0;
}
while(n>0) {
int r = k % n;
int x = k / n;
if (r != 0 && 2*r >= n) {
x++;
}
printf("%c", t[x]);
n--;
k -= x;
}
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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | #include <cstdio> #include <cassert> #include <algorithm> #include <vector> using namespace std; int n, k; char t[9]; int main() { int i; t[3] = 'a'; t[4] = 'e'; t[5] = 'u'; t[6] = 'o'; scanf("%d\n", &n); k = 0; for(i = 0; i < 8*n; ++i) { char a; scanf("%c", &a); if (a == '1') { k++; } } if (n*3 > k || k > n*6) { printf("NIE\n"); return 0; } while(n>0) { int r = k % n; int x = k / n; if (r != 0 && 2*r >= n) { x++; } printf("%c", t[x]); n--; k -= x; } printf("\n"); return 0; } |
English