#include <iostream>
#include <vector>
#include <cstring>
using namespace std;
int main(){
vector <int> hartal;
int test, days, party, h, hart[3653];
cin >> test;
while(test--){
cin >> days >> party;
memset(hart, 0, sizeof(hart));
for(int i = 1; i <= party; i++){
cin >> h;
for(int j = h; j <= days; j += h)hart[j]++;
}
for(int i = 1; i <= days; i++)if(hart[i] != 0)hartal.push_back(i);
int l = hartal.size(), ans = 0;
for(int i = 0; i < l; i++)if(hartal[i] % 7 != 0 && hartal[i] % 7 != 6)ans++;
cout << ans << endl;
hartal.clear();
}
return 0;
}
#include <vector>
#include <cstring>
using namespace std;
int main(){
vector <int> hartal;
int test, days, party, h, hart[3653];
cin >> test;
while(test--){
cin >> days >> party;
memset(hart, 0, sizeof(hart));
for(int i = 1; i <= party; i++){
cin >> h;
for(int j = h; j <= days; j += h)hart[j]++;
}
for(int i = 1; i <= days; i++)if(hart[i] != 0)hartal.push_back(i);
int l = hartal.size(), ans = 0;
for(int i = 0; i < l; i++)if(hartal[i] % 7 != 0 && hartal[i] % 7 != 6)ans++;
cout << ans << endl;
hartal.clear();
}
return 0;
}
No comments:
Post a Comment