QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#788556#5715. 幂次WTR200720 7ms11428kbC++201.3kb2024-11-27 17:25:002024-11-27 17:25:01

Judging History

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

  • [2024-11-27 17:25:01]
  • 评测
  • 测评结果:20
  • 用时:7ms
  • 内存:11428kb
  • [2024-11-27 17:25:00]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define MULT_TEST 0
using namespace std;
typedef long double ldb;
typedef unsigned long long ull;
const int INF = 0x3f3f3f3f;
const int MOD = 998244353;
inline int read() {
    int w = 0, f = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9') {
        if (ch == '-') f = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9') {
        w = (w << 1) + (w << 3) + ch - 48;
        ch = getchar();
    }
    return w * f;
}
const int N = 1000000, MAXN = 1E9;
int vis[N + 10];
inline void Solve() {
    int n, k, ans = 1, sum = 0;
    n = read(), k = read();
    if (k >= 60) return printf("1\n"), void();
    if (k == 1) return printf("%lld\n", n), void();
    for (int i = 2; i <= N; i++) {
        if (vis[i]) continue;
        for (int p = i, j = 1; p <= n; j++) {
            if (j >= k) {
                if (p <= N) vis[p] = 1;
                else if (p > N && p <= MAXN) sum++;
                ans++;
            }
            if (p <= n / i) p = p * i;
            else break;
        }
    }
    if (k == 2) ans += max(min(n, MAXN) - N - sum, 0ll);
    printf("%lld\n", ans);
}
signed main() {
    int _ = 1;
#if MULT_TEST
    _ = read();
#endif 
    while (_--) Solve();
    return 0;
}

详细


Pretests


Final Tests

Test #1:

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

input:

92 1

output:

92

result:

ok 1 number(s): "92"

Test #2:

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

input:

96 2

output:

12

result:

ok 1 number(s): "12"

Test #3:

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

input:

9383 3

output:

43

result:

wrong answer 1st numbers differ - expected: '37', found: '43'

Test #4:

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

input:

9830 2

output:

124

result:

ok 1 number(s): "124"

Test #5:

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

input:

927700 3

output:

164

result:

wrong answer 1st numbers differ - expected: '149', found: '164'

Test #6:

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

input:

972504 2

output:

1097

result:

ok 1 number(s): "1097"

Test #7:

score: 0
Wrong Answer
time: 7ms
memory: 10176kb

input:

94345650 3

output:

641

result:

wrong answer 1st numbers differ - expected: '605', found: '641'

Test #8:

score: 0
Wrong Answer
time: 3ms
memory: 11356kb

input:

98811802 2

output:

97812913

result:

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

Test #9:

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

input:

9328450690 3

output:

2613

result:

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

Test #10:

score: 0
Wrong Answer
time: 3ms
memory: 10788kb

input:

9775065820 2

output:

999069524

result:

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

Test #11:

score: 0
Wrong Answer
time: 6ms
memory: 10232kb

input:

948459050000 3

output:

11266

result:

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

Test #12:

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

input:

993120563000 2

output:

999975168

result:

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

Test #13:

score: 0
Wrong Answer
time: 5ms
memory: 10116kb

input:

93781484300000 3

output:

49575

result:

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

Test #14:

score: 0
Wrong Answer
time: 6ms
memory: 11392kb

input:

98250912400000 2

output:

1000017357

result:

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

Test #15:

score: 0
Wrong Answer
time: 3ms
memory: 10264kb

input:

9272034040000000 3

output:

222269

result:

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

Test #16:

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

input:

9981231040000000 2

output:

1000194426

result:

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

Test #17:

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

input:

942817384000000000 3

output:

1017300

result:

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

Test #18:

score: 0
Wrong Answer
time: 3ms
memory: 11428kb

input:

987478897000000000 2

output:

1000999031

result:

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

Test #19:

score: 0
Wrong Answer
time: 6ms
memory: 11332kb

input:

932205945000000000 2

output:

1000979594

result:

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

Test #20:

score: 0
Wrong Answer
time: 7ms
memory: 11256kb

input:

992520149596833024 2

output:

1001000767

result:

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