# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1265544 | herominhsteve | Pot (COCI15_pot) | C++20 | 0 ms | 328 KiB |
#include <bits/stdc++.h>
#define el '\n'
#define FNAME "NAME"
#define allof(x) x.begin(),x.end()
#define allof1(x) x.begin()+1,x.end()
#define mset(x,n) memset(x,(n),sizeof(x))
const long long MOD = (long long) 1e9+7;
template<class X,class Y> bool minimize(X &a,Y b){ if (a>b) {a=b; return true;} return false;}
template<class X,class Y> bool maximize(X &a,Y b){ if (a<b) {a=b; return true;} return false;}
void setup(){
std::ios_base::sync_with_stdio(0);
std::cin.tie(0);std::cout.tie(0);
if (fopen(FNAME".inp","r")){
freopen(FNAME".inp","r",stdin);
freopen(FNAME".out","w",stdout);
}
}
unsigned int indianpow(unsigned int a, unsigned int b){
if (!b) return 1;
unsigned int x = indianpow(a,b/2);
x = x * x;
if (b&1) return a*x;
return x;
}
int n;
void init(){
std::cin>>n;
}
void sol(){
unsigned int res = 0;
for (int i=0;i<n;i++){
unsigned int x; std::cin>>x;
unsigned int expo = x % 10;
unsigned int num = x/10;
res+= indianpow(num,expo);
}
std::cout<<res;
}
int main(){
setup();
init();
sol();
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |