Follows 10050.c (Total 30 lines):

/* @JUDGE_ID:4461XX 10050 C "easy" */
/* A */
#include<stdio.h>

int main( void )
{
	int casetime , n , i , j , k , sum , num_po , poli[100] ;

	scanf( "%d" , &casetime ) ;
	for( ; casetime ; casetime-- ){
		scanf( "%d" , &n ) ;

		scanf( "%d" , &num_po ) ;
		for( i=0 ; i<num_po ; i++ ) scanf( "%d" , &poli[i] ) ;
		for( sum=0,i=1,j=0 ; i<=n ; i++,j=(j+1)%7 ){
			if( j==5 || j==6 ) continue ;

			for( k=0 ; k<num_po ; k++ )
				if( !( i%poli[k] ) ){
					sum++ ;
					break ;
				}
		}
		
		printf( "%d\n" , sum ) ;
	}

	return 0 ;
}
/* @END_OF_SOURCE_CODE */

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