Niestety, nie byliśmy w stanie w pełni poprawnie wyświetlić tego pliku, ponieważ nie jest zakodowany w UTF-8.
Możesz pobrać ten plik i spróbować otworzyć go samodzielnie.
/* Rozwi�zanie zadania "Zabawki [C]" (ZAB) na Potyczki Algorytmiczne 2020. Damian Mazur */ #include <stdio.h> int n; char* ciag1; char* ciag2; int ciag1N[26] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; int ciag1P[26] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; int ciag2N[26] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; int ciag2P[26] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; int sprawdzCzyTabliceSaTakieSame() { for (int i = 0; i < 26; i++) { if (ciag1N[i] != ciag2N[i] || ciag1P[i] != ciag2P[i]) { return 0; } } return 1; } int main() { scanf("%d", &n); ciag1 = new char[n + 1]; ciag2 = new char[n + 1]; scanf("%s", ciag1); scanf("%s", ciag2); int czyP = 0; for (int i = 0; i < n; i++) { if (czyP) { ciag1P[ciag1[i] - 97]++; ciag2P[ciag2[i] - 97]++; } else { ciag1N[ciag1[i] - 97]++; ciag2N[ciag2[i] - 97]++; } czyP = !czyP; } if (sprawdzCzyTabliceSaTakieSame()) { printf("TAK"); } else { printf("NIE"); } 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 48 49 50 51 52 53 54 55 56 57 58 | /* Rozwi�zanie zadania "Zabawki [C]" (ZAB) na Potyczki Algorytmiczne 2020. Damian Mazur */ #include <stdio.h> int n; char* ciag1; char* ciag2; int ciag1N[26] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; int ciag1P[26] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; int ciag2N[26] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; int ciag2P[26] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; int sprawdzCzyTabliceSaTakieSame() { for (int i = 0; i < 26; i++) { if (ciag1N[i] != ciag2N[i] || ciag1P[i] != ciag2P[i]) { return 0; } } return 1; } int main() { scanf("%d", &n); ciag1 = new char[n + 1]; ciag2 = new char[n + 1]; scanf("%s", ciag1); scanf("%s", ciag2); int czyP = 0; for (int i = 0; i < n; i++) { if (czyP) { ciag1P[ciag1[i] - 97]++; ciag2P[ciag2[i] - 97]++; } else { ciag1N[ciag1[i] - 97]++; ciag2N[ciag2[i] - 97]++; } czyP = !czyP; } if (sprawdzCzyTabliceSaTakieSame()) { printf("TAK"); } else { printf("NIE"); } return 0; } |