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
56
//#include "pch.h"
#include <iostream>
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int length;
	int ones = 0;
	char c;
	cin >> length;
	for (int i = 0; i < 8 * length; i++)
	{
		cin >> c;
		if (c == '1')
		{
			ones++;
		}
	}
	if (ones < 3 * length || ones >6 * length)
	{
		cout << "NIE";
	}
	else
	{
		while (length>0)
		{
			if (ones > 5 * length)
			{
				length--;
				cout << "w";
				ones -= 6;
			}
			else if (ones > 4 * length)
			{
				length--;
				cout << "s";
				ones -= 5;
			}
			else if (ones > 3 * length)
			{
				length--;
				cout << "l";
				ones -= 4;
			}
			else if (ones > 2 * length)
			{
				length--;
				cout << "a";
				ones -= 3;
			}

		}
	}
	//system("pause");
}