Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <string>
- #include <sstream>
- #include <algorithm>
- #include <vector>
- #include <stdlib.h>
- #include <stdio.h>
- #include <fstream>
- #include <stack>
- #include <map>
- #include <cstring>
- #include <cmath>
- #include <set>
- #include <iterator>
- #include <cmath>
- using namespace std;
- istream & operator >> (istream & in, vector<int> & v)
- {
- string str;
- getline(in,str);
- stringstream stream(str);
- int tmp;
- while(stream >> tmp)
- v.push_back(tmp);
- return in;
- }
- int main()
- {
- int N, K;
- cin >> N >> K;
- int a, b, i;
- set<int> s;
- for (i = 0; i < K; ++i)
- {
- cin >> a >> b;
- for (auto j = a; j <= N; j += b)
- {
- if (j % 7 != 0 & (j + 1) % 7 != 0)
- s.insert(j);
- }
- }
- cout << s.size();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement