#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a, n, x, p, y, w;
string k;
int main(){
cin.tie(0);
ios_base::sync_with_stdio(0);
cin >> n >> k;
a=0;
while (k[a]!=0){
if (k[a]=='1'){
x++;
}
else {
y++;
}
a++;
}
a=1;
w=0;
while (n>0&&w==0){
//cout << "x=" << x << " y=" << y << endl;
p=x/n;
if (p>6||p<3){
cout << "NIE";
w=1;
}
else {
if(p==6){
cout << 'o';
}
if(p==5){
cout << 'g';
}
if(p==4){
cout << 'c';
}
if(p==3){
cout << 'a';
}
x=x-p;
}
n--;
}
}
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 51 52 53 54 55 | #include <bits/stdc++.h> using namespace std; typedef long long ll; ll a, n, x, p, y, w; string k; int main(){ cin.tie(0); ios_base::sync_with_stdio(0); cin >> n >> k; a=0; while (k[a]!=0){ if (k[a]=='1'){ x++; } else { y++; } a++; } a=1; w=0; while (n>0&&w==0){ //cout << "x=" << x << " y=" << y << endl; p=x/n; if (p>6||p<3){ cout << "NIE"; w=1; } else { if(p==6){ cout << 'o'; } if(p==5){ cout << 'g'; } if(p==4){ cout << 'c'; } if(p==3){ cout << 'a'; } x=x-p; } n--; } } |
English