QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#413477 | #5715. 幂次 | x-camp | 60 | 52ms | 15044kb | C++17 | 902b | 2024-05-17 16:46:12 | 2024-05-17 16:46:13 |
Judging History
answer
#include <iostream>
#include <vector>
#include <cmath>
#include <set>
using namespace std;
int main(int argc, const char * argv[]) {
vector<int> p
{ 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59};
long long n;
int k;
cin >> n >> k;
long long ans = 0;
if (k == 1) ans = n ;
else {
set<long long> mp;
for (int d = k; d<60; d++) {
for (int b=2; b<=100000; b++) {
if ( log(b) <= log(n+2)/d) {
long long x = pow(b, d) + 0.1;
if (x <= n)
mp.insert(pow(b,d));
}
else {
// cout << b-1 << " " << d << endl;
break;
}
}
}
ans += mp.size();
ans ++;
}
cout << ans;
return 0;
}
详细
Test #1:
score: 5
Accepted
time: 0ms
memory: 3452kb
input:
92 1
output:
92
result:
ok 1 number(s): "92"
Test #2:
score: 5
Accepted
time: 0ms
memory: 3876kb
input:
96 2
output:
12
result:
ok 1 number(s): "12"
Test #3:
score: 5
Accepted
time: 0ms
memory: 3944kb
input:
9383 3
output:
37
result:
ok 1 number(s): "37"
Test #4:
score: 5
Accepted
time: 0ms
memory: 3952kb
input:
9830 2
output:
124
result:
ok 1 number(s): "124"
Test #5:
score: 5
Accepted
time: 0ms
memory: 3792kb
input:
927700 3
output:
149
result:
ok 1 number(s): "149"
Test #6:
score: 5
Accepted
time: 0ms
memory: 4000kb
input:
972504 2
output:
1097
result:
ok 1 number(s): "1097"
Test #7:
score: 5
Accepted
time: 0ms
memory: 3840kb
input:
94345650 3
output:
605
result:
ok 1 number(s): "605"
Test #8:
score: 5
Accepted
time: 2ms
memory: 4368kb
input:
98811802 2
output:
10429
result:
ok 1 number(s): "10429"
Test #9:
score: 5
Accepted
time: 1ms
memory: 4048kb
input:
9328450690 3
output:
2541
result:
ok 1 number(s): "2541"
Test #10:
score: 5
Accepted
time: 18ms
memory: 8528kb
input:
9775065820 2
output:
101083
result:
ok 1 number(s): "101083"
Test #11:
score: 5
Accepted
time: 2ms
memory: 4404kb
input:
948459050000 3
output:
11116
result:
ok 1 number(s): "11116"
Test #12:
score: 0
Wrong Answer
time: 24ms
memory: 9024kb
input:
993120563000 2
output:
110915
result:
wrong answer 1st numbers differ - expected: '1006727', found: '110915'
Test #13:
score: 5
Accepted
time: 6ms
memory: 6336kb
input:
93781484300000 3
output:
49275
result:
ok 1 number(s): "49275"
Test #14:
score: 0
Wrong Answer
time: 33ms
memory: 10976kb
input:
98250912400000 2
output:
149660
result:
wrong answer 1st numbers differ - expected: '9958807', found: '149660'
Test #15:
score: 0
Wrong Answer
time: 20ms
memory: 9044kb
input:
9272034040000000 3
output:
111735
result:
wrong answer 1st numbers differ - expected: '221661', found: '111735'
Test #16:
score: 0
Wrong Answer
time: 49ms
memory: 13744kb
input:
9981231040000000 2
output:
211584
result:
wrong answer 1st numbers differ - expected: '100122721', found: '211584'
Test #17:
score: 0
Wrong Answer
time: 30ms
memory: 10228kb
input:
942817384000000000 3
output:
136224
result:
wrong answer 1st numbers differ - expected: '1016053', found: '136224'
Test #18:
score: 0
Wrong Answer
time: 50ms
memory: 14728kb
input:
987478897000000000 2
output:
236267
result:
wrong answer 1st numbers differ - expected: '994718860', found: '236267'
Test #19:
score: 0
Wrong Answer
time: 52ms
memory: 14992kb
input:
932205945000000000 2
output:
235758
result:
wrong answer 1st numbers differ - expected: '966488284', found: '235758'
Test #20:
score: 0
Wrong Answer
time: 52ms
memory: 15044kb
input:
992520149596833024 2
output:
236312
result:
wrong answer 1st numbers differ - expected: '997253882', found: '236312'