# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
82798 | xiaowuc1 | Pot (COCI15_pot) | C++14 | 2 ms | 588 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll powpow(ll b, ll e) {
ll r = 1;
while(e) {
if(e%2) {
r *= b;
}
b *= b;
e /= 2;
}
return r;
}
int main() {
int n;
cin >> n;
ll ret = 0;
while(n--) {
string s;
cin >> s;
int x = 0;
for(int i = 0; i < s.size()-1; i++) {
x *= 10;
x += s[i] - '0';
}
int y = s[s.size()-1] - '0';
ret += powpow(x, y);
}
printf("%lld\n", ret);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |