Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- const int dim_mat = 501;
- const int dim = 60001;
- ifstream f("numere9.in");
- ofstream g("numere9.out");
- void afiseaza_matricea( int a[ dim_mat ][ dim_mat ], int n )
- {
- int i, j;
- for( i = 1; i <= n; ++i )
- {
- for( j = 1; j <= n; ++j )
- g << a[ i ][ j ] << ' ';
- g << '\n';
- }
- g << "\n\n";
- }
- bool v[60001];/// initializeaza cu 0 <=> False
- int main()
- {
- int x,i,j,n, max = 0, min = dim_mat, cnt0 = 0, start1;
- f >> n;
- ///v = new bool[ n * n + 1];
- for(i=1;i<=n;i++)
- for(j=1;j<=n;j++)
- {
- f >> x;
- if( x == 0 )
- ++cnt0;
- if(x != 0 && x < 60001)
- v[ x ] = 1;
- }
- i = 1;
- while( v[ i ] != 0 )
- ++i;
- start1 = i;
- /*for(i=1;i<=n*n;i++)
- {
- if( v[i] == 0 )
- {
- if( i >= max ) max=i;
- if( i <= min ) min=i;
- }
- }
- g << min << " "<<max << endl;*/
- g << start1 <<" "<< start1 + cnt0 - 1 << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement