//Zadanie: Wybor zadan //Potyczki Algorytmiczne 2020 //Autor: AT #include <iostream> #include <string> using namespace std; int main() { int A1 = 0, B1 = 0, C1 = 0, A2 = 0, B2 = 0, C2 = 0, A3 = 0, B3 = 0, C3 = 0, A4 = 0, B4 = 0, C4 = 0, A5 = 0, B5 = 0, C5 = 0; int n; string z;//zadanie cin >> n; while(n--) { cin >> z; if(z == "1A") A1++; else if(z == "1B") B1++; else if(z == "1C") C1++; else if(z == "2A") A2++; else if(z == "2B") B2++; else if(z == "2C") C2++; else if(z == "3A") A3++; else if(z == "3B") B3++; else if(z == "3C") C3++; else if(z == "4A") A4++; else if(z == "4B") B4++; else if(z == "4C") C4++; else if(z == "5A") A5++; else if(z == "5B") B5++; else if(z == "5C") C5++; } bool OK = true; if(A1 < 1) OK = false; else if(B1 < 1) OK = false; else if(C1 < 1) OK = false; else if(A2 < 1) OK = false; else if(B2 < 1) OK = false; else if(C2 < 1) OK = false; else if(A3 < 1) OK = false; else if(B3 < 1) OK = false; else if(C3 < 1) OK = false; else if(A4 < 1) OK = false; else if(B4 < 1 ) OK = false; else if(C4 < 1) OK = false; else if(A5 < 2) OK = false; else if(B5 < 2) OK = false; else if(C5 < 2) OK = false; if(OK) cout << "TAK"; else cout << "NIE"; } /* we: 19 3B 4B 5B 4C 5C 3C 1A 5A 5C 3A 5A 2C 1B 2A 5B 5C 2B 1C 4A wy: TAK we: 20 2B 4B 4C 5A 5C 5C 4A 1B 3A 4A 2A 3B 1B 1C 1A 5A 2C 1B 5B 3C wy: NIE */
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 57 58 59 60 61 62 63 64 | //Zadanie: Wybor zadan //Potyczki Algorytmiczne 2020 //Autor: AT #include <iostream> #include <string> using namespace std; int main() { int A1 = 0, B1 = 0, C1 = 0, A2 = 0, B2 = 0, C2 = 0, A3 = 0, B3 = 0, C3 = 0, A4 = 0, B4 = 0, C4 = 0, A5 = 0, B5 = 0, C5 = 0; int n; string z;//zadanie cin >> n; while(n--) { cin >> z; if(z == "1A") A1++; else if(z == "1B") B1++; else if(z == "1C") C1++; else if(z == "2A") A2++; else if(z == "2B") B2++; else if(z == "2C") C2++; else if(z == "3A") A3++; else if(z == "3B") B3++; else if(z == "3C") C3++; else if(z == "4A") A4++; else if(z == "4B") B4++; else if(z == "4C") C4++; else if(z == "5A") A5++; else if(z == "5B") B5++; else if(z == "5C") C5++; } bool OK = true; if(A1 < 1) OK = false; else if(B1 < 1) OK = false; else if(C1 < 1) OK = false; else if(A2 < 1) OK = false; else if(B2 < 1) OK = false; else if(C2 < 1) OK = false; else if(A3 < 1) OK = false; else if(B3 < 1) OK = false; else if(C3 < 1) OK = false; else if(A4 < 1) OK = false; else if(B4 < 1 ) OK = false; else if(C4 < 1) OK = false; else if(A5 < 2) OK = false; else if(B5 < 2) OK = false; else if(C5 < 2) OK = false; if(OK) cout << "TAK"; else cout << "NIE"; } /* we: 19 3B 4B 5B 4C 5C 3C 1A 5A 5C 3A 5A 2C 1B 2A 5B 5C 2B 1C 4A wy: TAK we: 20 2B 4B 4C 5A 5C 5C 4A 1B 3A 4A 2A 3B 1B 1C 1A 5A 2C 1B 5B 3C wy: NIE */ |