---
# System prepended metadata

title: '(YKL20(UVA10050)) Hartals :'
tags: [CPP(CPE)]

---

#  (YKL20(UVA10050)) Hartals :  
YKL20_UVA10050_Hartals.cpp![image](https://hackmd.io/_uploads/rkv5LX4TA.png)
## 注意
vector 是從0 開始 所以說 要給他 n+1 把d[0] 直接不用就可以了


## code
```cpp!
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int t;
    cin >> t;
    // 迴圈 t 次測資
    for (int i = 0; i < t; i++)
    {
        int n, p;
        cin >> n >> p;
        // 紀錄哪天有罷工
        vector<int> d(n + 1, 0);
        int count = 0;
        for (int j = 0; j < p; j++)
        {
            int m;
            cin >> m;
            for (int k = m; k <= n; k += m)
            {
                if (k % 7 != 6 && k % 7 != 0)
                {
                    if (d[k] == 0)
                    {
                        count++;
                        d[k] = 1;
                    }
                }
            }
        }
        cout << count << endl;
    }
    return 0;
}
```