QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#364307#7562. Except Onezhouchenfeng#WA 1ms3676kbC++20484b2024-03-24 13:37:582024-03-24 13:37:59

Judging History

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

  • [2024-03-24 13:37:59]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3676kb
  • [2024-03-24 13:37:58]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;

#define int long long
int p, k, t;
int ans;

int qpow(int a, int b) {
	int cnt = 1;
	while(b) {
		if(b & 1) cnt = cnt * a % p;
		a = a * a % p;
		b >>= 1;
	}
	return cnt;
}

void solve(){
	cin >> p >> k >> t;
	int h = -qpow(k, t);
	ans = (h + p) % p;
	cout << ans << '\n';
}

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int t_ = 1;
//	cin >> t_;
	while(t_ --){
		solve();
	}
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3652kb

input:

7 5 3

output:

1

result:

ok 1 number(s): "1"

Test #2:

score: 0
Accepted
time: 1ms
memory: 3504kb

input:

11 6 7

output:

3

result:

ok 1 number(s): "3"

Test #3:

score: 0
Accepted
time: 1ms
memory: 3676kb

input:

3 2 1

output:

1

result:

ok 1 number(s): "1"

Test #4:

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

input:

596620183 516846890 38276329

output:

135352707

result:

ok 1 number(s): "135352707"

Test #5:

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

input:

382744931 85302262 235496559

output:

14577469

result:

ok 1 number(s): "14577469"

Test #6:

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

input:

659446013 641119314 378275666

output:

368821851

result:

wrong answer 1st numbers differ - expected: '290624162', found: '368821851'