QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#317514 | #7562. Except One | ikaurov# | WA | 0ms | 3744kb | C++17 | 569b | 2024-01-29 03:26:21 | 2024-01-29 03:26:22 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define all(arr) (arr).begin(), (arr).end()
#define ll long long
#define ld long double
#define pb push_back
#define sz(x) (int)(x).size()
#define fi first
#define se second
#define endl '\n'
ll binpow(ll a, ll b, ll p){
ll res = 1;
for (; b; a = a * a % p, b >>= 1){
if (b & 1) res = res * a % p;
}
return res;
}
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
// cout.precision(20);
int p, k, t;
cin >> p >> k >> t;
cout << (p - binpow(k, t, p)) % p << endl;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3684kb
input:
7 5 3
output:
1
result:
ok 1 number(s): "1"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
11 6 7
output:
3
result:
ok 1 number(s): "3"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
3 2 1
output:
1
result:
ok 1 number(s): "1"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
596620183 516846890 38276329
output:
135352707
result:
ok 1 number(s): "135352707"
Test #5:
score: 0
Accepted
time: 0ms
memory: 3744kb
input:
382744931 85302262 235496559
output:
14577469
result:
ok 1 number(s): "14577469"
Test #6:
score: -100
Wrong Answer
time: 0ms
memory: 3732kb
input:
659446013 641119314 378275666
output:
368821851
result:
wrong answer 1st numbers differ - expected: '290624162', found: '368821851'