QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#294017 | #7562. Except One | ivaziva | WA | 0ms | 3648kb | C++14 | 516b | 2023-12-30 02:16:12 | 2023-12-30 02:16:12 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
long long power(long long x,long long y,long long p)
{
long long res=1;
while (y>0)
{
if (y%2==1) res=(res*x);
y=y>>1;x=(x*x);
}
if (res<0) res=p-((-1)*res)%p;
if (res>=p) res%=p;
return res;
}
int main()
{
ios_base::sync_with_stdio(false);
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
long long p,k,t;
cin>>p>>k>>t;
k=k*(-1);
cout<<power(k,t,p)<<endl;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3520kb
input:
7 5 3
output:
1
result:
ok 1 number(s): "1"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3516kb
input:
11 6 7
output:
3
result:
ok 1 number(s): "3"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
3 2 1
output:
1
result:
ok 1 number(s): "1"
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3556kb
input:
596620183 516846890 38276329
output:
0
result:
wrong answer 1st numbers differ - expected: '135352707', found: '0'