No older revisions available
No older revisions available
~cpp
#include <iostream>
using namespace std;
int testcase, testdays, partyNum, i, j;
int party[100];
bool hartal[3651];
int counting;
int getHartal()
{
counting=0;
for(i=0; i<partyNum; i++)
{
for(j=1; j<3650; j++)
{
if(party[i]*j>testdays)
break;
if(hartal[party[i]*j])
{
counting++;
hartal[party[i]*j]=false;
}
}
}
return counting;
}
int main()
{
cin >> testcase;
while(testcase--)
{
cin>>testdays;
for(i=1; i<testdays+1; i++)
{
if(i%7==0 || i%7==6)
hartal[i]=false;
else
hartal[i]=true;
}
cin>>partyNum;
for(i=0; i<partyNum; i++)
cin >>party[i];
cout << getHartal()<< endl;
}
return 0;
}