# Hartals/조현태

## 소스 ¶

```~cpp
#include <stdio.h>
#include <iostream>

const int NUMBER_NOMAL_DAY=2;
const int NOMAL_DAYS[NUMBER_NOMAL_DAY]={6,7};

int day_simulate(int, int, int*);

void main()
{
int stage;
int* mans;
int* days;
int** mans_days;
printf("횟수를 입력하십시오.\n>>");
scanf("%d",&stage);
days=(int*)malloc(sizeof(int)*stage);
mans=(int*)malloc(sizeof(int)*stage);
mans_days=(int**)malloc(sizeof(int*)*stage);
for (int i=0; i<stage; ++i)
{
printf("시뮬레이션 할 날의 수를 입력하십시오.\n>>");
scanf("%d",days+i);
printf("연합의 수를 입력하십시오.\n>>");
scanf("%d",mans+i);
mans_days[i]=(int*)malloc(sizeof(int)*mans[i]);
printf("각 연합들의 파업주기를 입력하십시오.\n");
for (int j=0; j<mans[i]; ++j)
{
printf(">>");
scanf("%d",mans_days[i]+j);
}
}
for (register int i=0; i<stage; ++i)
{
printf("%d\n",day_simulate(days[i],mans[i],mans_days[i]));
}
for (int i=0; i<stage; ++i)
free(mans_days[i]);
free(mans_days);
free(mans);
}

int day_simulate(int input_day, int input_number_mans, int* input_mans)
{
int play_day=0;
for (register int i=1; i<=input_day; ++i)
{
register int j;
for (j=0;j<NUMBER_NOMAL_DAY;++j)
{
if (0==(i-NOMAL_DAYS[j])%7)
break;
}
if (j==NUMBER_NOMAL_DAY)
{
for (j=0;j<input_number_mans;++j)
{
if (0==i%input_mans[j])
{
++play_day;
break;
}
}
}
}
return play_day;
}
```