# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
3487 | Apple_Cplus | 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 <cstdio>
int main(void)
{
int n, K;
scanf("%d %d", &n, &K);
if(K == 0) printf("%d\n", n);
else
{
long long cur = 1;
for(int i=30;i>=0;i--)
{
cur = cur * cur % (n + 1);
if(n & (1LL << i)) cur = cur * n % (n + 1);
}
printf("%d\n", cur);
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |