Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- #include <set>
- #include <iostream>
- using namespace std;
- const int mod = 1000000007;
- long long a, b, c, ab, bc, abc;
- set<long long> s;
- long long powmod(long long a, long long b)
- {
- long long r = 1;
- while (b)
- {
- if (b&1)
- {
- r = (r * a) % mod;
- b--;
- }
- else
- {
- b >>= 1;
- a = (a * a) % mod;
- }
- }
- return r;
- }
- long long Hash(long long num)
- {
- return num * num * num * num;
- }
- int main()
- {
- freopen("numbers.in", "r", stdin);
- freopen("numbers.out", "w", stdout);
- cin >> a >> b >> c;
- s.insert(Hash(a+b+c));
- s.insert(Hash(a+b*c));
- s.insert(Hash(a*b+c));
- s.insert(Hash(a*b*c));
- ab = powmod(a,b);
- s.insert(Hash(ab+c));
- s.insert(Hash(ab*c));
- bc = powmod(b,c);
- abc = powmod(a,bc);
- s.insert(Hash(abc));
- cout << s.size();
- }
Advertisement
Add Comment
Please, Sign In to add comment