Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _USE_MATH_DEFINES
- #include <iostream>
- #include <string>
- #include <map>
- #include <set>
- #include <algorithm>
- #include <vector>
- #include <stdio.h>
- #include <cmath>
- #include <math.h>
- #include <queue>
- #include <stack>
- #include <climits>
- #include <deque>
- #include <ctime>
- using namespace std;
- typedef long long ll;
- typedef unsigned long long ull;
- typedef unsigned int ui;
- #define mh() make_heap()
- #define poph() pop_heap()
- #define pushh() push_heap()
- #define sor(n) n.begin(), n.end()
- #define mp make_pair
- #define files freopen("input.txt", "rt", stdin); freopen("output.txt", "wt", stdout)
- #define p(T) pair<T,T>
- #define znac(l) abs(l)/l
- const ll ok = ll(1e9 + 7);
- pair<ll,ll> gf(ll a)
- {
- ll sc = 0;
- while (a % 2 == 0)
- {
- a /= 2;
- sc++;
- }
- return mp(a, sc);
- }
- int main()
- {
- //files;
- ll n;
- cin >> n;
- map<ll, ll> lh;
- ll prom;
- for (int i = 1; i <= n; i++)
- {
- cin >> prom;
- if (prom % 2 != 0)
- {
- lh[prom]++;
- }
- else
- {
- p(ll) k = gf(prom);
- lh[k.first] += pow(2,k.second);
- }
- }
- ll max = 0;
- for (auto i = lh.begin(); i != lh.end(); i++)
- {
- ll jo = i->first;
- ll o = i->second;
- if (o != 1)
- {
- while (o != 0)
- {
- jo *= 2;
- o /= 2;
- o -= o % 2;
- }
- }
- if (jo >= max)
- {
- max = jo;
- }
- }
- cout << max;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment