Skip to content

Instantly share code, notes, and snippets.

@SF-Zhou
Created March 26, 2017 09:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SF-Zhou/dab5a7ddb85a60c834ff750f38b1caec to your computer and use it in GitHub Desktop.
Save SF-Zhou/dab5a7ddb85a60c834ff750f38b1caec to your computer and use it in GitHub Desktop.
2017 Netease Set
#include <iostream>
#include <string>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <cmath>
#include <map>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define ff(i, n) for (int i = 0, END = (n); i < END; i ++)
#define fff(i, n, m) for (int i = (n), END = (m); i <= END; i ++)
#define dff(i, n, m) for (int i = (n), END = (m); i >= END; i --)
#define travel(e, first) for (int e = first, v = vv[first]; ~e; e = nxt[e], v = vv[e])
#define clr(a, b) memset(a, b, sizeof(a))
typedef long long ll;
int gcd(int a, int b) {
if (b == 0) return a;
return gcd(b, a % b);
}
int main() {
int w, x, y, z;
while (cin >> w >> x >> y >> z) {
unordered_set<int> s;
fff (i, w, x) fff (j, y, z) {
int c = gcd(i, j);
s.insert((i * 100 + j) / c);
}
cout << s.size() << endl;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment