#include <iostream> using namespace std; int main(){ ios_base::sync_with_stdio(0); cin.tie(NULL); int n, tmp, amount_of_ones=0; cin>>n; for(int i=0;i<n;i++){ cin>>tmp; if(tmp == 1) amount_of_ones++; } if(amount_of_ones >= 2) cout<<"0\n2\n1 2"; if(amount_of_ones == 1) cout<<"1\n2\n1 2"; if(amount_of_ones == 0) cout<<"2\n2\n1 2"; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #include <iostream> using namespace std; int main(){ ios_base::sync_with_stdio(0); cin.tie(NULL); int n, tmp, amount_of_ones=0; cin>>n; for(int i=0;i<n;i++){ cin>>tmp; if(tmp == 1) amount_of_ones++; } if(amount_of_ones >= 2) cout<<"0\n2\n1 2"; if(amount_of_ones == 1) cout<<"1\n2\n1 2"; if(amount_of_ones == 0) cout<<"2\n2\n1 2"; } |