#include <cstdio> int main() { int N; scanf("%d", &N); int leafs = 0; int degree; while (N--) { scanf("%d", °ree); if (degree == 1) ++leafs; if (leafs == 2) break; } printf("%d\n2\n1 2\n", 2 - leafs); 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 | #include <cstdio> int main() { int N; scanf("%d", &N); int leafs = 0; int degree; while (N--) { scanf("%d", °ree); if (degree == 1) ++leafs; if (leafs == 2) break; } printf("%d\n2\n1 2\n", 2 - leafs); return 0; } |