QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#369120#7562. Except OnelolilolikonWA 1ms3676kbC++141.0kb2024-03-27 20:50:022024-03-27 20:50:04

Judging History

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

  • [2024-03-27 20:50:04]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3676kb
  • [2024-03-27 20:50:02]
  • 提交

answer

#include <bits/stdc++.h>
#define FAST                     \
    ios::sync_with_stdio(false); \
    cin.tie(0);                  \
    cout.tie(0)
#define debug(x) cout << endl << #x << ": " << x << endl
#define endl "\n"
#define PII pair<int, int>
#define PID pair<int, double>
#define PDI pair<double, int>
#define ls p << 1
#define rs (p << 1) + 1
#define pb push_back
#define ppb pop_back
#define fs first
#define sc second
#define int ll
#define Random(x)                       \
    mt19937_64 rnd(random_device {}()); \
    uniform_int_distribution<int> u(1, (x)-5);
using ll = long long;
using ull = unsigned long long;
using db = double;
using namespace std;
const int N = 1e5, INF = 1e9;

int p, k, t;

int qmi(int x, int q) {
	int res = 1;
	while(q) {
		if(q & 1) res = res * x % p;
		x = x * x % p;
		q >>= 1;
	}
	return res;
}

void solve() {
    cin >> p >> k >> t;
    cout << (p - qmi(k, t)) % p;
}

signed main() {
    FAST;
    int T = 1;
    // cin >> T;
    while(T--) solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

7 5 3

output:

1

result:

ok 1 number(s): "1"

Test #2:

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

input:

11 6 7

output:

3

result:

ok 1 number(s): "3"

Test #3:

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

input:

3 2 1

output:

1

result:

ok 1 number(s): "1"

Test #4:

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

input:

596620183 516846890 38276329

output:

135352707

result:

ok 1 number(s): "135352707"

Test #5:

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

input:

382744931 85302262 235496559

output:

14577469

result:

ok 1 number(s): "14577469"

Test #6:

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

input:

659446013 641119314 378275666

output:

368821851

result:

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