#include <cstdio> using namespace std; int n, a, oneCount; int main() { scanf ("%d\n", &n); for (int i = 0; i < n; i++) { scanf ("%d", &a); if (a == 1) oneCount ++; } if (oneCount == 0) printf ("2\n"); else if (oneCount == 1) printf ("1\n"); else printf ("0\n"); printf ("2\n"); printf ("1 2\n"); }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #include <cstdio> using namespace std; int n, a, oneCount; int main() { scanf ("%d\n", &n); for (int i = 0; i < n; i++) { scanf ("%d", &a); if (a == 1) oneCount ++; } if (oneCount == 0) printf ("2\n"); else if (oneCount == 1) printf ("1\n"); else printf ("0\n"); printf ("2\n"); printf ("1 2\n"); } |