Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma comment(linker, "/Stack:266000000")
- #include <iostream>
- #include <cstdio>
- #include <cstring>
- #include <string>
- #include <cmath>
- #include <memory.h>
- #include <algorithm>
- #include <queue>
- #include <stack>
- #include <vector>
- #include <cstdlib>
- #include <map>
- #include <bitset>
- #include <set>
- using namespace std;
- #define INF 1E+9
- #define INFll 9223372036854775807
- #define EPS 1E-7
- #define MAXN
- #define MAXL
- #define mp(x, y) make_pair(x, y)
- #define pb(x) push_back(x)
- #define all(a) (a).begin(), (a).end()
- #ifndef ONLINE_JUDGE
- # define LOG(x) (cerr << #x << " = " << (x) << endl)
- #else
- # define LOG(x) 0
- #endif
- typedef long long LL;
- typedef long double dbl;
- dbl binpow(dbl a, dbl n) {
- if (n == 0)
- return 1;
- if (long(n) % 2 == 1)
- return binpow(a, n - 1) * a;
- else {
- dbl b = binpow(a, n / 2);
- return b * b;
- }
- }
- int main(){
- freopen("differ.in", "r", stdin);
- freopen("differ.out", "w", stdout);
- int ans = 0;
- dbl a, b;
- cin >> a >> b;
- map <double, int> m;
- if (a > b)
- swap(a, b);
- ++m[a + b];
- ++m[a - b];
- ++m[b - a];
- ++m[a * b];
- if (a != 0)
- ++m[b / a];
- if (b != 0)
- ++m[a / b];
- if (a != 0)
- {
- LL tmp = 1;
- bool f = true;
- for (int i = 0; i < a && f; ++i)
- {
- LL val = tmp;
- tmp *= b * 1ll;
- if (tmp / b != val)
- ans = 1, f = false;
- }
- if (f)
- ++m[(long double(tmp))];
- }
- if (b != 0)
- {
- LL tmp = 1;
- bool f = true;
- for (int i = 0; i < b && f; ++i)
- {
- LL val = tmp;
- tmp *= a * 1ll;
- if (tmp / a != val)
- ++ans, f = false;
- }
- if (f)
- ++m[(long double (tmp))];
- }
- cout << m.size() + ans;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement