#include <cstdio> #include <algorithm> using namespace std; typedef pair<int, int> pii; const int INF = 1e7; int main() { int n; scanf("%d", &n); int a = INF; int b = INF; for(int i = 1; i <= n; i++) { int d; scanf("%d", &d); if(d < a) { b = a; a = d; } else if(d < b) b = d; } int w = 0; if(a > 1) w++; if(b > 1) w++; printf("%d\n2\n1 2", w); }
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 <cstdio> #include <algorithm> using namespace std; typedef pair<int, int> pii; const int INF = 1e7; int main() { int n; scanf("%d", &n); int a = INF; int b = INF; for(int i = 1; i <= n; i++) { int d; scanf("%d", &d); if(d < a) { b = a; a = d; } else if(d < b) b = d; } int w = 0; if(a > 1) w++; if(b > 1) w++; printf("%d\n2\n1 2", w); } |