QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#96068 | #969. Discrete Logarithm is a Joke | APJifengc | AC ✓ | 2724ms | 3692kb | C++14 | 479b | 2023-04-13 08:35:15 | 2023-04-13 08:35:17 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const long long P = 1000000000000000031;
long long qpow(__int128_t a, long long b) {
__int128_t ans = 1;
while (b) {
if (b & 1) ans = ans * a % P;
a = a * a % P;
b >>= 1;
}
return ans;
}
int n;
int main() {
scanf("%d", &n);
n = 1000000 - n;
long long ans = 300;
while (n--) {
ans = qpow(42, ans);
}
printf("%lld\n", ans);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2724ms
memory: 3632kb
input:
0
output:
960002411612632915
result:
ok 1 number(s): "960002411612632915"
Test #2:
score: 0
Accepted
time: 2720ms
memory: 3680kb
input:
1
output:
836174947389522544
result:
ok 1 number(s): "836174947389522544"
Test #3:
score: 0
Accepted
time: 1903ms
memory: 3584kb
input:
300300
output:
263358264583736303
result:
ok 1 number(s): "263358264583736303"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
1000000
output:
300
result:
ok 1 number(s): "300"
Test #5:
score: 0
Accepted
time: 35ms
memory: 3680kb
input:
987654
output:
323040897684351053
result:
ok 1 number(s): "323040897684351053"
Test #6:
score: 0
Accepted
time: 2719ms
memory: 3640kb
input:
2
output:
360265688540078138
result:
ok 1 number(s): "360265688540078138"
Test #7:
score: 0
Accepted
time: 2ms
memory: 3648kb
input:
999999
output:
580046907013163142
result:
ok 1 number(s): "580046907013163142"
Test #8:
score: 0
Accepted
time: 2564ms
memory: 3624kb
input:
57136
output:
886385729914317304
result:
ok 1 number(s): "886385729914317304"
Test #9:
score: 0
Accepted
time: 1328ms
memory: 3680kb
input:
511436
output:
649262956642775134
result:
ok 1 number(s): "649262956642775134"