Submission #464523

# Submission time Handle Problem Language Result Execution time Memory
464523 2021-08-13T10:54:09 Z Itamar Rack (eJOI19_rack) C++14
Compilation error
0 ms 0 KB
#include <iostream>
using namespace std;
#include <algorithm>

long long a = pow(10, 9) + 7;

long long fun(long long n, long long k) {
    if (k == 1) {
        return 1;
    }
    
    if (k % 2 == 0) {
        long long x = fun(n - 1, k / 2);
        long long b = pow(2, n - 1);
        return (x + b) %  a;

    }
    else {
        long long x = fun(n - 1, k / 2 + 1);
        return x% a;
    }

}
int main()
{
    long long n, k;
    cin >> n;
    cin >> k;
    cout << fun(n, k);
}

Compilation message

rack.cpp:5:15: error: 'pow' was not declared in this scope
    5 | long long a = pow(10, 9) + 7;
      |               ^~~
rack.cpp: In function 'long long int fun(long long int, long long int)':
rack.cpp:14:23: error: 'pow' was not declared in this scope
   14 |         long long b = pow(2, n - 1);
      |                       ^~~