#include<bits/stdc++.h>
using namespace std;
char t[10];
int main () {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n, ile1=0, x, z1, z2, y;
cin >> n;
string s;
cin >> s;
t[3]='a';
t[4]='c';
t[5]='g';
t[6]='o';
for (int i=0; i<s.size(); i++) {
if (s[i]=='1') {
ile1++;
}
}
if ((ile1/(1.00*n)<3) or (ile1/(1.00*n)>6)) {
cout << "NIE";
}
else {
y=ile1/n;
z1=ile1%n;
z2=n-ile1%n;
for (int i=1; i<=z1; i++) {
cout << t[y+1];
}
for (int i=1; i<=z2; i++) {
cout << t[y];
}
}
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 | #include<bits/stdc++.h> using namespace std; char t[10]; int main () { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, ile1=0, x, z1, z2, y; cin >> n; string s; cin >> s; t[3]='a'; t[4]='c'; t[5]='g'; t[6]='o'; for (int i=0; i<s.size(); i++) { if (s[i]=='1') { ile1++; } } if ((ile1/(1.00*n)<3) or (ile1/(1.00*n)>6)) { cout << "NIE"; } else { y=ile1/n; z1=ile1%n; z2=n-ile1%n; for (int i=1; i<=z1; i++) { cout << t[y+1]; } for (int i=1; i<=z2; i++) { cout << t[y]; } } return 0; } |
English