#include <bits/stdc++.h>
using namespace std;
int n,z,j;
char x;
string w;
int main()
{
cin >> n;
for (int i=1; i<=8*n; i++)
{
cin >> x;
if (x == '0') z++;
else j++;
}
if (j<n*3 || j>n*6)
{
printf("NIE\n");
return 0;
}
j-=3*n;
while (j>=3)
{
w+='w';
j-=3;
}
if (j == 2) w+='s';
else if (j==1) w+='c';
while (w.size()<n) w+='a';
cout << w << endl;
}
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 | #include <bits/stdc++.h> using namespace std; int n,z,j; char x; string w; int main() { cin >> n; for (int i=1; i<=8*n; i++) { cin >> x; if (x == '0') z++; else j++; } if (j<n*3 || j>n*6) { printf("NIE\n"); return 0; } j-=3*n; while (j>=3) { w+='w'; j-=3; } if (j == 2) w+='s'; else if (j==1) w+='c'; while (w.size()<n) w+='a'; cout << w << endl; } |
English