QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#84994#5661. Multi-LadderspiasticOuO#WA 2ms3424kbC++14765b2023-03-06 21:36:272023-03-06 21:36:41

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-06 21:36:41]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3424kb
  • [2023-03-06 21:36:27]
  • 提交

answer

#include <iostream>
using namespace std;
const long long modf = 1e9 + 7;
long long T, n, k, u;

long long qc(long long x, long long y) {
	long long uu = 1;
	while (y) {
		if (y & 1)
			uu = uu * x % modf;
		x = x * x % modf;
		y >>= 1;
	}
	return uu;
}

void solve() {
	cin >> n >> k >> u;
	if (u <= 2) {
		cout << 0;
		return;
	}
	long long d = ((u - 2) * (u - 2) % modf + u - 1) % modf;
	long long v = k * (n - 1) % modf;
	long long dy = qc(d, v);
	long long c;
	if (k == 3) {
		c = 6;
	} else {
		c = d * u % modf;
		c = c * qc(u - 1, k - 3) % modf;
	}
	long long ans = c * dy % modf;
	cout << ans << '\n';
}

int main() {

	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> T;
	while (T--) {
		solve();
	}

	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 2ms
memory: 3340kb

input:

1
2 3 3

output:

162

result:

ok single line: '162'

Test #2:

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

input:

20
2 3 3
1 3 3
10 3 0
10 3 2
1 21 2
1 22 0
2000 15000 2000
12000 30000 200000
1000000000 3 3
2 1000000000 3
2 3 100000000
1000000000 1000000000 10
1000000000 3 100000000
2 1000000000 100000000
1 1000000000 10
1 1000000000 100000000
1 1000 100000000
1000000000 1000000000 0
1000000000 1000000000 1
100...

output:

162
6
0000164845369
945582174
5832209
779538007
419819051
981071775
771767690
998580122
429257881
970014134
915187317
00194404537

result:

wrong answer 3rd lines differ - expected: '0', found: '0000164845369'