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
#include <iostream>
using namespace std;

int main(){
    int n, one = 0; string b;
    cin >> n; cin >> b;
    for(int i = 0 ; i != n*8 ; i++){
        if(b[i] == '1'){
            one++ ;
        }
    }
    if((one/n) < 3 || (one/n) > 6){
        cout << "NIE";
    } else {
        one = one - (3*n);
        for(int i = 0; i!= n ; i++){
            switch(one){
                case 0 :
                    cout << "a";
                    break;
                case 1 :
                    cout << "c";
                    one = 0;
                    break;
                case 2 :
                    cout << "g";
                    one = 0;
                    break;
                case 3 :
                    cout << "o";
                    one = 0;
                    break;
                default :
                    cout << "o";
                    one = one -3;
                    break;
            }
        }
    }
    cout << endl;
}