Follows 700.c (Total 27 lines):

/* @JUDGE_ID:4461XX 700 C */
/* A */
#include<stdio.h>
void main( void )
{
	int i ;
	for( i=1 ; ; i++ ){
		int n , y[20] , a[20] , b[20] , arr[10000] , j , k ;
		scanf( "%d" , &n ) ;
		if( !n ) break ;
		printf( "Case #%d:\n" , i ) ;
		for( j=0 ; j<10000 ; j++ ) arr[j] = 1 ;
		for( j=0 ; j<n ; j++ ){
			scanf( "%d %d %d" , &y[j] , &a[j] , &b[j] ) ;
			for( k=0 ; k<y[j] ; k++ ) arr[k] = 0 ;
			for( k=y[j] ; k<10000 ; k++ )
				if( ((k-y[j])%(b[j]-a[j])) ) arr[k] = 0 ;
		}
		for( j=0 ; j<10000 ; j++ )
			if( arr[j] ){
				printf( "The actual year is %d.\n\n" , j ) ;
				k = 0 ;
				break ;
			}
		if( k ) printf( "Unknown bugs detected.\n\n" ) ;
	}
}

Back to statistics
Ya-Lin Huang (C)
huangyl@gmail.com