#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <math.h>
#include <time.h>

using namespace std;
const int MAP_DIM = 100;
struct point{ int x, y; };

inline float d( point* p1, point* p2 )
{	return( sqrt( pow((float)(p1->x-p2->x),2) + pow((float)(p1->y-p2->y),2) ) ); }


int main( int argc, char** argv )
{
	if( argc != 2 ) {
		cerr << "usage: " << argv[0] << " dimension" << endl;
		return( -1 );
	}

	int dim = atoi( argv[1] );
	int key;
	point pts[dim];

	srand( (unsigned)time( NULL ) );

	// Punkte auf MAP_DIM x MAP_DIM grid zufaellig verteilen
	for( int i=0; i<dim; i++ ) {
		pts[i].x = 1 + (int) ((float)MAP_DIM*rand()/(RAND_MAX+1.0));
		pts[i].y = 1 + (int) ((float)MAP_DIM*rand()/(RAND_MAX+1.0));
	}

	// Distanzmatrix ausgeben
	cout << dim <<endl;
	cout <<setiosflags(ios::fixed) <<setprecision(2);
	for( int i=1; i<dim; i++ ) {
		for( int j=0; j<i; j++ ) {
			cout << d( &pts[i], &pts[j] ) << " ";
		}
		cout << endl;
	}

	return 0;
}
