//runda 2C #include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { ios_base::sync_with_stdio(0); int n, ilosc1 = 0, srednio, reszta; char c; char znaki[] = {'-','-','-','a','c','g','o'}; cin >> n; for(int iN = 0; iN < (int)8 * n; ++iN) { cin >> c; if(c == '1') ++ilosc1; } if((ilosc1 < (int)3 * n) || (ilosc1 > (int)6 * n)) { cout << "NIE"; return 0; } srednio = ilosc1 / n; reszta = ilosc1 % n; for(int r = 0; r < reszta; ++r) cout << znaki[srednio + 1]; for(int s = reszta; s < n; ++s) cout << znaki[srednio]; 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 | //runda 2C #include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { ios_base::sync_with_stdio(0); int n, ilosc1 = 0, srednio, reszta; char c; char znaki[] = {'-','-','-','a','c','g','o'}; cin >> n; for(int iN = 0; iN < (int)8 * n; ++iN) { cin >> c; if(c == '1') ++ilosc1; } if((ilosc1 < (int)3 * n) || (ilosc1 > (int)6 * n)) { cout << "NIE"; return 0; } srednio = ilosc1 / n; reszta = ilosc1 % n; for(int r = 0; r < reszta; ++r) cout << znaki[srednio + 1]; for(int s = reszta; s < n; ++s) cout << znaki[srednio]; return 0; } |