Submission #377443

#TimeUsernameProblemLanguageResultExecution timeMemory
377443marat0210Pot (COCI15_pot)C++14
45 / 50
1 ms364 KiB
#include <bits/stdc++.h> using namespace std; long long power(long long n, long long p) { long long k = n; for (int i = 0; i < p - 1; ++i) { n *= k; } return n; } int main() { long long n; cin >>n; vector <long long> p(n); vector <long long> a(n); for (int i = 0; i < n; ++i) { long long k; cin >>k; p[i] = k % 10; a[i] = k / 10; } long long sum = 0; for (int i = 0; i < n; ++i) { sum += power(a[i], p[i]); } cout <<sum<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...