QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#208328#7562. Except OneSolarExpressWA 0ms3656kbC++14291b2023-10-09 13:52:002023-10-09 13:52:01

Judging History

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

  • [2023-10-09 13:52:01]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3656kb
  • [2023-10-09 13:52:00]
  • 提交

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'