Advertisement
OMEGAHEAD_MonkoX

B

Jan 20th, 2020
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <string>
  4. #include <sstream>
  5. #include <algorithm>
  6. #include <vector>
  7. #include <stdlib.h>
  8. #include <stdio.h>
  9. #include <fstream>
  10. #include <stack>
  11. #include <map>
  12. #include <cstring>
  13. #include <cmath>
  14. #include <set>
  15. #include <iterator>
  16. #include <cmath>
  17.  
  18. using namespace std;
  19.  
  20. istream & operator >> (istream & in, vector<int> & v)
  21. {
  22. string str;
  23. getline(in,str);
  24. stringstream stream(str);
  25. int tmp;
  26. while(stream >> tmp)
  27. v.push_back(tmp);
  28. return in;
  29. }
  30.  
  31.  
  32. int main()
  33. {
  34. int N, K;
  35. cin >> N >> K;
  36. int a, b, i;
  37. set<int> s;
  38. for (i = 0; i < K; ++i)
  39. {
  40. cin >> a >> b;
  41. for (auto j = a; j <= N; j += b)
  42. {
  43. if (j % 7 != 0 & (j + 1) % 7 != 0)
  44. s.insert(j);
  45. }
  46. }
  47. cout << s.size();
  48. return 0;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement