#include <cstdio> #include <algorithm> using namespace std; #define MAXN 1000100 int tab[ MAXN ]; int minimum, minimum2; void Add( int a, int p ) { if( a <= minimum ) { minimum2 = minimum; minimum = a; } else { if( a <= minimum2 ) { minimum2 = a; } } } int main() { minimum = MAXN; minimum2 = MAXN; int n; scanf( "%d", &n ); for( int i = 0; i < n; ++i ) { scanf( "%d", tab + i ); Add( tab[i], i ); } if( (minimum == 1) && (minimum2 == 1) ) { puts("0\n2\n1 2"); return 0; } if( (minimum == 1) || (minimum2==1) ) { puts("1\n2\n1 2"); return 0; } puts("2\n2\n1 2"); 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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | #include <cstdio> #include <algorithm> using namespace std; #define MAXN 1000100 int tab[ MAXN ]; int minimum, minimum2; void Add( int a, int p ) { if( a <= minimum ) { minimum2 = minimum; minimum = a; } else { if( a <= minimum2 ) { minimum2 = a; } } } int main() { minimum = MAXN; minimum2 = MAXN; int n; scanf( "%d", &n ); for( int i = 0; i < n; ++i ) { scanf( "%d", tab + i ); Add( tab[i], i ); } if( (minimum == 1) && (minimum2 == 1) ) { puts("0\n2\n1 2"); return 0; } if( (minimum == 1) || (minimum2==1) ) { puts("1\n2\n1 2"); return 0; } puts("2\n2\n1 2"); return 0; } |