QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#294017#7562. Except OneivazivaWA 0ms3648kbC++14516b2023-12-30 02:16:122023-12-30 02:16:12

Judging History

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

  • [2023-12-30 02:16:12]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3648kb
  • [2023-12-30 02:16:12]
  • 提交

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'