QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#304236 | #7562. Except One | NemanjaSo2005 | WA | 0ms | 3700kb | C++14 | 442b | 2024-01-13 16:53:04 | 2024-01-13 16:53:05 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll p,k,t;
ll stepen(ll a,ll koji){
if(koji==0)
return 1;
if(koji==1)
return a;
ll ret=stepen(a,koji/2);
ret=(ret*ret)%p;
if(koji%2==1)
ret=(ret*a)%p;
return ret;
}
ll modp(ll x){
x--;
if(x<0)
x+=p;
return x;
}
int main(){
cin>>p>>k>>t;
t=p-t;
cout<<modp(stepen(t,k))<<endl;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3624kb
input:
7 5 3
output:
1
result:
ok 1 number(s): "1"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
11 6 7
output:
3
result:
ok 1 number(s): "3"
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3700kb
input:
3 2 1
output:
0
result:
wrong answer 1st numbers differ - expected: '1', found: '0'