题目意思就是有个公司,有很多会议,每个会都是每隔几天开一次。问在一定天数内有多少天有会。
第一行是测试组数。每组 给出n天,就是要你计算的天数,都是从周天开始。然后给出总共有几种会,然后下面是这些会都是每隔几天开的。碰到周五周六的不开。。
模拟即可,很简单。。
AC代码:
#include<iostream>
using namespace std;
const int N = 3700;
int main () {
int T;
int day;
int hday;
cin >> T;
int h[N];
bool har[N] = {false};
while (T--) {
int count = 0;
cin >> day;
cin >> hday;
for (int i = 1 ; i <= hday ; i++) {
cin >> h[i];
}
for (int i = 1 ; i <= hday;i++) {
for (int j = 1 ; j <= day; j++) {
if (j % h[i] == 0 && j % 7 != 6 && j % 7 != 0) {
har[j] = true;
}
}
}
for (int i = 1; i <= day;i++)
if (har[i] == true)
count++;
cout << count <<endl;
for (int i = 1;i < N ;i ++)
har[i] = false;
}
return 0;
}