#include <bits/stdc++.h>
#include "Annalib.h"
typedef long long ll;
using namespace std;
int mark[151];
ll power(ll x, ll y)
{
if(y == 0) return 1;
ll ret = 1;
while(y--) ret *= x;
return ret;
}
void Anna(int n, long long x, int k, int p[] )
{
ll temp = x, cnt = 0;
memset(mark, 0, sizeof mark);
for(int i=0; i<k; i++) mark[p[i]] = 1;
ll a[38];
for(ll i=37; i>=0; i--)
{
if(temp >= power(3, i)*2) temp -= power(3, i)*2, a[i] = 2;
else if(temp >= power(3, i)) temp -= power(3, i), a[i] = 1;
else a[i] = 0;
}
for(int i=0; i<n; i+=2)
{
if(mark[i] || mark[i+1] || cnt > 37) Set(i, 0), Set(i+1, 0);
else
{
if(a[cnt] == 2) Set(i, 1), Set(i+1, 1);
else if(a[cnt] == 1) Set(i, 1), Set(i+1, 0);
else Set(i, 0), Set(i+1, 1);
cnt++;
}
}
}
#include "Brunolib.h"
#include <bits/stdc++.h>
//~ #include "Anna.cpp"
//~ #include "grader.cpp"
typedef long long ll;
using namespace std;
long long Bruno(int n, int a[] )
{
ll cnt = 0;
ll x = 0;
for(int i=0; i<n; i+=2)
{
if(!a[i] && !a[i+1]) continue;
int b;
if(a[i] == 1 && a[i+1] == 1) b = 2;
else if(a[i] == 1) b = 1;
else b = 0;
x += b*power(3, cnt++);
}
return x;
}
Compilation message
Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:19:10: error: 'power' was not declared in this scope
x += b*power(3, cnt++);
^~~~~
Bruno.cpp:19:10: note: suggested alternative: 'popen'
x += b*power(3, cnt++);
^~~~~
popen