Submission #377443

# Submission time Handle Problem Language Result Execution time Memory
377443 2021-03-14T08:21:51 Z marat0210 Pot (COCI15_pot) C++14
45 / 50
1 ms 364 KB
#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 time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Incorrect 1 ms 364 KB Output isn't correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct