Skip to content

Instantly share code, notes, and snippets.

@Abreto
Last active December 16, 2015 14:49
Show Gist options
  • Save Abreto/5450950 to your computer and use it in GitHub Desktop.
Save Abreto/5450950 to your computer and use it in GitHub Desktop.
PC110203 - UVa10050
/* PC 110203 - Hartals */
#include <stdio.h>
int main(void)
{
int T = 0;
scanf("%d", &T);
while (T--)
{
int i = 0, j = 0;
int N = 0, P = 0;
int h[100] = {0};
int counter = 0;
scanf("%d %d", &N, &P);
for(i = 0;i < P;++i)
scanf("%d", h+i);
/* simulation process */
for(i = 0;i < N;++i)
{
/* it is the ith day. */
if( 6 == (i+1)%7 || 0 == (i+1)%7 )
continue;
for(j = 0;j < P;++j)
if( 0 == (i+1)%h[j] )
{
counter ++;
break;
}
}
/* print the answer. */
printf("%d\n", counter);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment