QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#788564 | #5715. 幂次 | WTR2007 | 75 | 5ms | 11760kb | C++20 | 1.2kb | 2024-11-27 17:28:05 | 2024-11-27 17:28:05 |
Judging History
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 (p <= N) vis[p] = 1;
if (j >= k) 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: 3824kb
input:
92 1
output:
92
result:
ok 1 number(s): "92"
Test #2:
score: 5
Accepted
time: 2ms
memory: 3820kb
input:
96 2
output:
12
result:
ok 1 number(s): "12"
Test #3:
score: 5
Accepted
time: 1ms
memory: 4016kb
input:
9383 3
output:
37
result:
ok 1 number(s): "37"
Test #4:
score: 5
Accepted
time: 0ms
memory: 3960kb
input:
9830 2
output:
124
result:
ok 1 number(s): "124"
Test #5:
score: 5
Accepted
time: 5ms
memory: 11000kb
input:
927700 3
output:
149
result:
ok 1 number(s): "149"
Test #6:
score: 5
Accepted
time: 4ms
memory: 11416kb
input:
972504 2
output:
1097
result:
ok 1 number(s): "1097"
Test #7:
score: 5
Accepted
time: 5ms
memory: 11656kb
input:
94345650 3
output:
605
result:
ok 1 number(s): "605"
Test #8:
score: 5
Accepted
time: 5ms
memory: 11580kb
input:
98811802 2
output:
10429
result:
ok 1 number(s): "10429"
Test #9:
score: 5
Accepted
time: 2ms
memory: 11572kb
input:
9328450690 3
output:
2541
result:
ok 1 number(s): "2541"
Test #10:
score: 5
Accepted
time: 2ms
memory: 11572kb
input:
9775065820 2
output:
101083
result:
ok 1 number(s): "101083"
Test #11:
score: 5
Accepted
time: 5ms
memory: 11580kb
input:
948459050000 3
output:
11116
result:
ok 1 number(s): "11116"
Test #12:
score: 5
Accepted
time: 5ms
memory: 11572kb
input:
993120563000 2
output:
1006727
result:
ok 1 number(s): "1006727"
Test #13:
score: 5
Accepted
time: 5ms
memory: 11568kb
input:
93781484300000 3
output:
49275
result:
ok 1 number(s): "49275"
Test #14:
score: 0
Wrong Answer
time: 5ms
memory: 11584kb
input:
98250912400000 2
output:
1048916
result:
wrong answer 1st numbers differ - expected: '9958807', found: '1048916'
Test #15:
score: 5
Accepted
time: 5ms
memory: 11652kb
input:
9272034040000000 3
output:
221661
result:
ok 1 number(s): "221661"
Test #16:
score: 0
Wrong Answer
time: 5ms
memory: 11760kb
input:
9981231040000000 2
output:
1225985
result:
wrong answer 1st numbers differ - expected: '100122721', found: '1225985'
Test #17:
score: 5
Accepted
time: 0ms
memory: 11644kb
input:
942817384000000000 3
output:
1016053
result:
ok 1 number(s): "1016053"
Test #18:
score: 0
Wrong Answer
time: 5ms
memory: 11632kb
input:
987478897000000000 2
output:
2030590
result:
wrong answer 1st numbers differ - expected: '994718860', found: '2030590'
Test #19:
score: 0
Wrong Answer
time: 0ms
memory: 11576kb
input:
932205945000000000 2
output:
2011153
result:
wrong answer 1st numbers differ - expected: '966488284', found: '2011153'
Test #20:
score: 0
Wrong Answer
time: 2ms
memory: 11580kb
input:
992520149596833024 2
output:
2032326
result:
wrong answer 1st numbers differ - expected: '997253882', found: '2032326'