Advertisement
Guest User

Untitled

a guest
Mar 26th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <cstdio>
  4. #include <cstring>
  5. #include <vector>
  6. #include <queue>
  7. #include <cmath>
  8. #include <map>
  9. #include <unordered_map>
  10. #include <unordered_set>
  11. using namespace std;
  12.  
  13. #define ff(i, n) for (int i = 0, END = (n); i < END; i ++)
  14. #define fff(i, n, m) for (int i = (n), END = (m); i <= END; i ++)
  15. #define dff(i, n, m) for (int i = (n), END = (m); i >= END; i --)
  16. #define travel(e, first) for (int e = first, v = vv[first]; ~e; e = nxt[e], v = vv[e])
  17. #define clr(a, b) memset(a, b, sizeof(a))
  18. typedef long long ll;
  19.  
  20. int gcd(int a, int b) {
  21. if (b == 0) return a;
  22. return gcd(b, a % b);
  23. }
  24.  
  25. int main() {
  26. int w, x, y, z;
  27. while (cin >> w >> x >> y >> z) {
  28. unordered_set<int> s;
  29.  
  30. fff (i, w, x) fff (j, y, z) {
  31. int c = gcd(i, j);
  32. s.insert((i * 100 + j) / c);
  33. }
  34.  
  35. cout << s.size() << endl;
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement