Example #1
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 #2
0
void QtWithoutForm::resizeEvent(QResizeEvent *risize) {
	//int wid, hei;
    int wid = risize->size().width();
    int hei = risize->size().height();
    button->setGeometry(wid / 2, hei / 2, 80, 20);
    testprint();
    printf("qt without form resize. \n");
}
Example #3
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 #4
0
int main(){
	int a[] = {3,2,5,1,7,6};
	quicksort(a, 0, 5);
	testprint(a, 6);
	return 0;
}
Example #5
0
int main(){
  int fd, state, i;
  char buf[16];

  *buf = 0;

  state = close(17);
  testprint("close unopened fd, should fail", state == -1);

  fd = creat("testfile");
  printf("file descriptor: %d\n", fd);
  testprint( "creat file `testfile`", fd > -1 );

  state = close( fd );
  testprint( "close file `testfile`", state == 0 );

  state = unlink( "testfile" );
  testprint( "unlink file `testfile`", state == 0 );

  fd = creat( "writefile" );
  printf("file descriptor: %d\n", fd);
  testprint( "creat file `writefile`", fd > -1 );

  state = write( fd, "foo", 3 );
  testprint( "write line `foo` to `writefile`", state == 3 );

  state = close( fd );
  testprint( "close file `writefile`", state == 0 );

  fd = open( "writefile" );
  printf("file descriptor: %d\n", fd);
  testprint( "open file `writefile`", fd > -1 );

  state = read( fd, buf, 16 );
  printf("read content: %c%c%c\n", buf[0], buf[1], buf[2]);
  testprint( "read from file `writefile`", state > 0 );

  state = close( fd );
  testprint( "close file `writefile`", state == 0 );

  state = 0;
  for (i = 0; i < 14; ++i){
    fd = open("writefile");
    if (fd < 0)
      state = -1;
  }
  testprint("opened 14 fds (+2 for io)", state == 0 );

  return 0;

}