QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#208328 | #7562. Except One | SolarExpress | WA | 0ms | 3656kb | C++14 | 291b | 2023-10-09 13:52:00 | 2023-10-09 13:52:01 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int n,m,k,ans;
int power(int x,int y){
int RE=1;
while(y){
if(y&1)RE=(RE*x)%n;
x=(x*x)%n;
y>>=1;
}
return RE;
}
int main(){
cin>>n>>m>>k;
ans=((1+n)*n/2-m-n)%n*power(m,k-1)%n;
if(!(k&1))ans=n-ans;
cout<<ans<<endl;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3532kb
input:
7 5 3
output:
1
result:
ok 1 number(s): "1"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
11 6 7
output:
3
result:
ok 1 number(s): "3"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
3 2 1
output:
1
result:
ok 1 number(s): "1"
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3644kb
input:
596620183 516846890 38276329
output:
-574324249
result:
wrong answer 1st numbers differ - expected: '135352707', found: '-574324249'