Pagini recente » Autentificare | Cod sursa (job #2254114) | Cod sursa (job #2092176) | Cod sursa (job #629714) | Cod sursa (job #1333664)
#include <fstream>
const char IN [ ] = "oras.in" ;
const char OUT [ ] = "oras.out" ;
const int MAX = 214 ;
using namespace std;
ifstream fin ( IN ) ;
ofstream fout ( OUT ) ;
int mat [ MAX ] [ MAX ] ;
int main( )
{
int n , add;
fin >> n ;
if ( n & 1 )
add = 2 ;
else add = 3 ;
for ( int i = 1 ; i < n ; ++ i )
for ( int j = i + 1 ; j <= n ; ++ j )
mat [ i ] [ j ] = 1 ;
for ( int i = 1 ; i <= n ; ++ i )
for ( int j = i - add ; j >= 1 ; -- j )
{
mat [ i ] [ j ] = 1 ;
mat [ j ] [ i ] = 0 ;
}
if ( ( n & 1 ) == 0 ){
mat [ 3 ] [ n ] = 1 ;
mat [ n ] [ 3 ] = 0 ;
}
for ( int i = 1 ; i <= n ; ++ i ){
for ( int j = 1 ; j <= n ; ++ j )
fout << mat [ i ] [ j ] ;
fout << '\n' ;
}
return 0;
}