#include <bits/stdc++.h>
using namespace std;
int main()
{
long sum = 0;
int n;
cin >> n;
for (int i = 0; i < n; i++)
{
long in;
cin >> in;
in = (long)pow(2, in);
string str = to_string(in);
str = str.length() > 2 ? str.substr(str.length() - 2) : str;
in = stoi(str);
sum += in;
}
cout << sum % 100 << endl;
return 0;
}
Created
July 1, 2020 08:50
-
-
Save therohitdas/933f537889bc15e549d6d4168a8e6c64 to your computer and use it in GitHub Desktop.
E
--
Follows time limitation. Output time 1s
#include <bits/stdc++.h>
using namespace std;
time_t start, end_time;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<vi> vvi;
int x, counter = 0;
unordered_set<int> squareFreeFactor;
bool flag = true;
bool isPerfectSquare(int x)
{
return ((floor(sqrt(x)) - sqrt(x)) == 0);
}
unordered_set<int> factor(int a)
{
unordered_set<int> currentFactor;
for (int i = 2; i < a / 2; i++)
{
if (a % i == 0)
{
if (a / i == i)
{
if (!isPerfectSquare(i))
currentFactor.insert(i);
else
flag = false;
}
else
{
if (!isPerfectSquare(i))
currentFactor.insert(i);
else
flag = false;
if (!isPerfectSquare(a / i))
currentFactor.insert(a / i);
else
flag = false;
}
}
}
return currentFactor;
}
void factor_void(int a)
{
for (int i = 2; i < sqrt(a); i++)
{
if (a % i == 0)
{
if (a / i == i)
{
if (isPerfectSquare(i))
flag = false;
}
else
{
if (isPerfectSquare(i))
flag = false;
if (isPerfectSquare(a / i))
flag = false;
}
}
}
}
void solve()
{
unordered_set<int> fac = factor(x);
if (flag)
{
counter++;
}
else
{
flag = true;
}
for (int a : fac)
{
factor_void(a);
if (flag)
{
counter++;
}
else
{
flag = true;
}
}
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> x;
time(&start);
solve();
cout << counter << endl;
time(&end_time);
cout << double(end_time - start) << "s";
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
G