QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#300349#7562. Except OnedoziccWA 0ms3520kbC++14384b2024-01-08 03:54:452024-01-08 03:54:46

Judging History

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

  • [2024-01-08 03:54:46]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3520kb
  • [2024-01-08 03:54:45]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

long long stepen(long long broj, long long step, long long mod)
{
    if(step==1)return broj;
    long long res=stepen(broj, step/2, mod);
    if(step%2==0)return (res*res)%mod;
    return (broj*res*res)%mod;
}

int main()
{
    long long p, k, t; cin>>p>>k>>t;
    cout<<(stepen(-k, t, p)+p)%p<<endl;
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3472kb

input:

7 5 3

output:

1

result:

ok 1 number(s): "1"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3520kb

input:

11 6 7

output:

3

result:

ok 1 number(s): "3"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3476kb

input:

3 2 1

output:

1

result:

ok 1 number(s): "1"

Test #4:

score: -100
Wrong Answer
time: 0ms
memory: 3468kb

input:

596620183 516846890 38276329

output:

519404832

result:

wrong answer 1st numbers differ - expected: '135352707', found: '519404832'