QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#413452#5715. 幂次x-camp40 332ms14816kbC++17988b2024-05-17 16:20:242024-05-17 16:20:24

Judging History

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

  • [2024-05-17 16:20:24]
  • 评测
  • 测评结果:40
  • 用时:332ms
  • 内存:14816kb
  • [2024-05-17 16:20:24]
  • 提交

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<int> mp;
        /*
        if (k == 2) {
            int x = floor( log(n)/log(2));
            ans += x-1;
            cout << x << endl;
        }*/
     
        for (int d = k; d<60; d++) {
            if (d < k) continue;
            for (int b=2; b<=100000; b++) {
                long long x = pow(b,d);
                if (x <= n)
                    mp.insert(x);
                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: 3572kb

input:

92 1

output:

92

result:

ok 1 number(s): "92"

Test #2:

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

input:

96 2

output:

12

result:

ok 1 number(s): "12"

Test #3:

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

input:

9383 3

output:

37

result:

ok 1 number(s): "37"

Test #4:

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

input:

9830 2

output:

124

result:

ok 1 number(s): "124"

Test #5:

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

input:

927700 3

output:

149

result:

ok 1 number(s): "149"

Test #6:

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

input:

972504 2

output:

1097

result:

ok 1 number(s): "1097"

Test #7:

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

input:

94345650 3

output:

605

result:

ok 1 number(s): "605"

Test #8:

score: 5
Accepted
time: 3ms
memory: 4276kb

input:

98811802 2

output:

10429

result:

ok 1 number(s): "10429"

Test #9:

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

input:

9328450690 3

output:

2540

result:

wrong answer 1st numbers differ - expected: '2541', found: '2540'

Test #10:

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

input:

9775065820 2

output:

101080

result:

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

Test #11:

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

input:

948459050000 3

output:

11098

result:

wrong answer 1st numbers differ - expected: '11116', found: '11098'

Test #12:

score: 0
Wrong Answer
time: 15ms
memory: 9112kb

input:

993120563000 2

output:

110892

result:

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

Test #13:

score: 0
Wrong Answer
time: 40ms
memory: 6276kb

input:

93781484300000 3

output:

49150

result:

wrong answer 1st numbers differ - expected: '49275', found: '49150'

Test #14:

score: 0
Wrong Answer
time: 101ms
memory: 10848kb

input:

98250912400000 2

output:

149511

result:

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

Test #15:

score: 0
Wrong Answer
time: 99ms
memory: 8924kb

input:

9272034040000000 3

output:

111277

result:

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

Test #16:

score: 0
Wrong Answer
time: 180ms
memory: 13732kb

input:

9981231040000000 2

output:

211070

result:

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

Test #17:

score: 0
Wrong Answer
time: 186ms
memory: 10076kb

input:

942817384000000000 3

output:

135087

result:

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

Test #18:

score: 0
Wrong Answer
time: 330ms
memory: 14788kb

input:

987478897000000000 2

output:

235029

result:

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

Test #19:

score: 0
Wrong Answer
time: 300ms
memory: 14700kb

input:

932205945000000000 2

output:

234536

result:

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

Test #20:

score: 0
Wrong Answer
time: 332ms
memory: 14816kb

input:

992520149596833024 2

output:

235073

result:

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