QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#413463#5715. 幂次x-camp40 29ms10324kbC++17910b2024-05-17 16:34:302024-05-17 16:34:31

Judging History

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

  • [2024-05-17 16:34:31]
  • 评测
  • 测评结果:40
  • 用时:29ms
  • 内存:10324kb
  • [2024-05-17 16:34:30]
  • 提交

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;
        
        if (k == 2) {
            int x = floor( log(n)/log(2));
            ans += x-1;
        }
     
        for (int d = max(3,k); d<60; d++) {
            for (int b=2; b<=100000; b++) {
                if ( log(b) <= log(n)/d)
                    mp.insert(pow(b,d));
                else {
                   // cout << b-1 << " " << d << endl;
                    break;
                }
            }
        }
        ans += mp.size();
        ans ++;
    }
    cout << ans;
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 5
Accepted
time: 0ms
memory: 3556kb

input:

92 1

output:

92

result:

ok 1 number(s): "92"

Test #2:

score: 5
Accepted
time: 0ms
memory: 3844kb

input:

96 2

output:

12

result:

ok 1 number(s): "12"

Test #3:

score: 5
Accepted
time: 0ms
memory: 3852kb

input:

9383 3

output:

37

result:

ok 1 number(s): "37"

Test #4:

score: 0
Wrong Answer
time: 0ms
memory: 3928kb

input:

9830 2

output:

49

result:

wrong answer 1st numbers differ - expected: '124', found: '49'

Test #5:

score: 5
Accepted
time: 1ms
memory: 3928kb

input:

927700 3

output:

149

result:

ok 1 number(s): "149"

Test #6:

score: 0
Wrong Answer
time: 0ms
memory: 3904kb

input:

972504 2

output:

169

result:

wrong answer 1st numbers differ - expected: '1097', found: '169'

Test #7:

score: 5
Accepted
time: 1ms
memory: 3872kb

input:

94345650 3

output:

605

result:

ok 1 number(s): "605"

Test #8:

score: 0
Wrong Answer
time: 1ms
memory: 3948kb

input:

98811802 2

output:

638

result:

wrong answer 1st numbers differ - expected: '10429', found: '638'

Test #9:

score: 5
Accepted
time: 1ms
memory: 4032kb

input:

9328450690 3

output:

2541

result:

ok 1 number(s): "2541"

Test #10:

score: 0
Wrong Answer
time: 0ms
memory: 4020kb

input:

9775065820 2

output:

2611

result:

wrong answer 1st numbers differ - expected: '101083', found: '2611'

Test #11:

score: 5
Accepted
time: 2ms
memory: 4440kb

input:

948459050000 3

output:

11116

result:

ok 1 number(s): "11116"

Test #12:

score: 0
Wrong Answer
time: 2ms
memory: 4496kb

input:

993120563000 2

output:

11320

result:

wrong answer 1st numbers differ - expected: '1006727', found: '11320'

Test #13:

score: 5
Accepted
time: 9ms
memory: 6152kb

input:

93781484300000 3

output:

49275

result:

ok 1 number(s): "49275"

Test #14:

score: 0
Wrong Answer
time: 10ms
memory: 6188kb

input:

98250912400000 2

output:

50072

result:

wrong answer 1st numbers differ - expected: '9958807', found: '50072'

Test #15:

score: 0
Wrong Answer
time: 25ms
memory: 8844kb

input:

9272034040000000 3

output:

111735

result:

wrong answer 1st numbers differ - expected: '221661', found: '111735'

Test #16:

score: 0
Wrong Answer
time: 17ms
memory: 9048kb

input:

9981231040000000 2

output:

112003

result:

wrong answer 1st numbers differ - expected: '100122721', found: '112003'

Test #17:

score: 0
Wrong Answer
time: 26ms
memory: 10184kb

input:

942817384000000000 3

output:

136224

result:

wrong answer 1st numbers differ - expected: '1016053', found: '136224'

Test #18:

score: 0
Wrong Answer
time: 25ms
memory: 10324kb

input:

987478897000000000 2

output:

136692

result:

wrong answer 1st numbers differ - expected: '994718860', found: '136692'

Test #19:

score: 0
Wrong Answer
time: 25ms
memory: 10296kb

input:

932205945000000000 2

output:

136183

result:

wrong answer 1st numbers differ - expected: '966488284', found: '136183'

Test #20:

score: 0
Wrong Answer
time: 29ms
memory: 10200kb

input:

992520149596833024 2

output:

136737

result:

wrong answer 1st numbers differ - expected: '997253882', found: '136737'