QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#304236#7562. Except OneNemanjaSo2005WA 0ms3700kbC++14442b2024-01-13 16:53:042024-01-13 16:53:05

Judging History

你现在查看的是最新测评结果

  • [2024-01-13 16:53:05]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3700kb
  • [2024-01-13 16:53:04]
  • 提交

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'