#include <bits/stdc++.h> int main(){ std::ios_base::sync_with_stdio(0); std::cin.tie(NULL); int ilosc = 0, n, x; std::cin >> n; for(int i = 0; i < n; i++){ std::cin >> x; if(x == 1) ilosc++; } std::cout << (2 - std::min(2, ilosc)) << "\n" << "2" << "\n" << "1 2" << "\n"; }
1 2 3 4 5 6 7 8 9 10 11 12 | #include <bits/stdc++.h> int main(){ std::ios_base::sync_with_stdio(0); std::cin.tie(NULL); int ilosc = 0, n, x; std::cin >> n; for(int i = 0; i < n; i++){ std::cin >> x; if(x == 1) ilosc++; } std::cout << (2 - std::min(2, ilosc)) << "\n" << "2" << "\n" << "1 2" << "\n"; } |