#include<stdlib.h> #include<iostream> #include<string> #include<vector> using namespace std; long N; long sum = 0; void parse () { cin >> N; } int main () { parse(); int byla1 = 0; long int liczba; for (long long i = 0; i < N; ++i) { cin >> liczba; if (liczba == 1) { byla1++; if (byla1 == 2) { cout << 0 << endl << 2 << endl << "1 2\n"; return 0; } } } cout << 2 - byla1 << endl << 2 << endl << "1 2\n"; 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 | #include<stdlib.h> #include<iostream> #include<string> #include<vector> using namespace std; long N; long sum = 0; void parse () { cin >> N; } int main () { parse(); int byla1 = 0; long int liczba; for (long long i = 0; i < N; ++i) { cin >> liczba; if (liczba == 1) { byla1++; if (byla1 == 2) { cout << 0 << endl << 2 << endl << "1 2\n"; return 0; } } } cout << 2 - byla1 << endl << 2 << endl << "1 2\n"; return 0; } |