# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
4040 | pmpmp | Great Pow! (kriii1_G) | C++98 | 0 ms | 1088 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <stdio.h>
long long a, bb;
long long dfs(int k)
{
long long aa;
if(k==1){ return a; }
aa=dfs(k/2)%(a+1);
if(k%2==1){return (( (a*aa)%(a+1) )*aa)%(a+1);}
else{ return (aa*aa)%(a+1); }
}
int main ()
{
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
int b, c;
int i, j, k, t;
scanf("%lld %d", &a, &k);
bb=dfs(k+1);
printf("%lld", bb%(a+1));
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |