#include <iostream> using namespace std; int main() { int n, iloscj = 0, maks = 0; float suma = 0; bool war = false; cin >> n; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; suma += a[i]; if (i > 0 && a[i] != a[i - 1]) war = true; max(maks, a[i]); if (a[i] == 1) iloscj++; } if (iloscj > 1) { cout << 0 << endl; cout << 2 << endl; cout << 1 << " " << 2; } else { if (iloscj == 1) { cout << 1 << endl; cout << 2 << endl; cout << 1 << " " << 2; } else { cout << 0 << endl; cout << 2 << endl; cout << 1 << " " << 2; } } 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 59 60 61 | #include <iostream> using namespace std; int main() { int n, iloscj = 0, maks = 0; float suma = 0; bool war = false; cin >> n; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; suma += a[i]; if (i > 0 && a[i] != a[i - 1]) war = true; max(maks, a[i]); if (a[i] == 1) iloscj++; } if (iloscj > 1) { cout << 0 << endl; cout << 2 << endl; cout << 1 << " " << 2; } else { if (iloscj == 1) { cout << 1 << endl; cout << 2 << endl; cout << 1 << " " << 2; } else { cout << 0 << endl; cout << 2 << endl; cout << 1 << " " << 2; } } return 0; } |