QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#108516#2601. Lucky TicketszghtyarecrenjWA 2ms3540kbC++14459b2023-05-25 13:35:072023-05-25 13:35:10

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-25 13:35:10]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3540kb
  • [2023-05-25 13:35:07]
  • 提交

answer

#include <bits/stdc++.h>

using ll = long long;

inline ll qpow(ll x, ll y, ll p) {
	ll z = 1;
	for (; y; y >>= 1, x = x * x % p)
		if (y & 1) z = z * x % p;
	return z;
}

ll n, s, q;

int main() {
	std::ios::sync_with_stdio(false);
	std::cin >> n >> s >> q;
	ll res = 0;
	for (ll i = 0; i < n; ++i) {
		ll t = i * (qpow(2, q, q) + q - 1) % q;
		if (s == (qpow(i, q, n) + q * i) % n) res += t;
	}
	std::cout << res << '\n';
	return 0;
}

详细

Test #1:

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

input:

2 0 2

output:

0

result:

ok 1 number(s): "0"

Test #2:

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

input:

10 9 2

output:

1

result:

ok 1 number(s): "1"

Test #3:

score: 0
Accepted
time: 2ms
memory: 3300kb

input:

3 2 3

output:

2

result:

ok 1 number(s): "2"

Test #4:

score: 0
Accepted
time: 2ms
memory: 3348kb

input:

2 1 2

output:

1

result:

ok 1 number(s): "1"

Test #5:

score: 0
Accepted
time: 2ms
memory: 3540kb

input:

4 0 3

output:

1

result:

ok 1 number(s): "1"

Test #6:

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

input:

4 2 3

output:

2

result:

ok 1 number(s): "2"

Test #7:

score: -100
Wrong Answer
time: 1ms
memory: 3536kb

input:

20 4 19

output:

24

result:

wrong answer 1st numbers differ - expected: '5', found: '24'