output::output()
{
	while (true) {
		// get current system time
		GetSystemTime(&time);

		// initialize our input class
		input triangle;

		try {
			triangle.run();
		}
		catch (Exception &e) {
			std::cerr << "Library Exception!!! " << e.description() << std::endl;
		}

		maindata = triangle.data;

		processing RTA(triangle.data);

		printoutput(time, index(RTA));

		Sleep(1000);
	}
}
Example #2
0
int rec(int x) {
	if (x == 0)
		return 1;
	else
	{
		printoutput(x);
		return rec(x-1);
	}
}
Example #3
0
File: a2.c Project: 98943mek/IOI
int main( void )
{
	while( readinput() ) {
        #if DBG
    	testprint() ;
        #endif
	    solve() ;
        #if DBG
    	testprint() ;
        #endif
	    printoutput() ;
	    memset( bits, 0, sizeof(bits) ) ;
	    memset( output, 0, sizeof(output) ) ;
	}
	return EXIT_SUCCESS ;
}
Example #4
0
File: b.c Project: 98943mek/IOI
int main( void )
{
	int problem ;
	for( problem = 1 ; ; problem++ ) {
		int edges ;
		if( fscanf( stdin, "%d\n", &size ) == EOF ) {
			break ;
		}
		assert( size >= 2 ) ;
		assert( size <= MAX_DOTS ) ;
		memset( hlines, 0, sizeof( hlines ) ) ;
		memset( vlines, 0, sizeof( vlines ) ) ;
		fscanf( stdin, "%d\n", &edges ) ;
		while( edges-- ) {
			char c ;
			int i, j ;
			fscanf( stdin, " %c %d %d\n", &c, &i, &j ) ;
			i-- ;
			j-- ;
			assert( i >= 0 ) ;
			assert( j >= 0 ) ;
			if( c == 'H' ) {
				assert( i < size  ) ;
				assert( j < size - 1 ) ;
				assert( ! hlines[ i ][ j ] ) ;
				hlines[ i ][ j ] = 1 ;
			}
			else {
				assert( c == 'V' ) ;
				assert( i < size ) ;
				assert( j < size - 1 ) ;
				assert( ! vlines[ j ][ i ] ) ;
				vlines[ j ][ i ] = 1 ;
			}
		}
        #ifdef DBG
		testprint() ;
        #endif
		solve() ;
        #ifdef DBG
		testprint2() ;
        #endif
		printoutput( problem ) ;
	}
	return EXIT_SUCCESS ;
}
Example #5
0
/* main */
main( int argc, char *argv[] )
{

  int                natoms, nrgeoms;
  int                          *dist;
  struct geometry           *refgeom, *ptr2, *tmp2;
  struct point               *ptdata, *ptr1, *tmp1;

  /* process command line arguments */
  if ( argc == 3 ) { /* argc should be 3 */
    natoms  = strtol( argv[1], NULL, 10 ); /* number of atoms */
    nrgeoms = strtol( argv[2], NULL, 10 ); /* number of geoms */
  } else {
    printf( "\n usage: %s [num. atoms] [num. geoms]\n", argv[0] );
    exit(1);
  }
  /* allocate first node of refgeom */
  refgeom = malloc( sizeof( struct geometry ) );
  refgeom->atom = malloc( natoms * sizeof( struct xyz ) );
  refgeom->next = 0;
  /* read in refgeom file, building refgeom array */
  readinput( natoms, nrgeoms, refgeom );
  
  /* allocate distances array */
  dist = malloc( (5 * 2) * sizeof( int ) );
  dist[0] = 1;
  dist[1] = 2; /* C-O  bond distance */
  dist[2] = 1;
  dist[3] = 5; /* O-H  bond distance */
  dist[4] = 2;
  dist[5] = 3; /* C-H1 bond distance */
  dist[6] = 2;
  dist[7] = 4; /* C-H2 bond distance */
  dist[8] = 2; 
  dist[9] = 5; /* C-H3 bond distance */
  /* allocate first node of data aray */
  ptdata = malloc( sizeof( struct point ) );
  /* 5 distances + 2 OOP angles */
  ptdata->coord = malloc( (5 + 2) * sizeof( double ) );
  ptdata->next = 0;
  /* compute distances */
  computedist( dist, nrgeoms, refgeom, ptdata );
  /* compute rms energy and gradient errors */
  computerms( nrgeoms, ptdata );
  /* print distances */
  printoutput( nrgeoms, ptdata );
  
  /* dellocate memory */
  ptr1 = ptdata;
  while ( ptr1 != NULL ) {
    tmp1 = ptr1;
    ptr1 = ptr1->next;
    free( tmp1 );
  }
  ptdata = NULL;
  ptr2 = refgeom;
  while (ptr2 != NULL ) {
    tmp2 = ptr2;
    ptr2 = ptr2->next;
    free( tmp2 );
  }
  refgeom = NULL;
}