QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#859481 | #9680. 数字变换 | lgvc | 18 | 50ms | 4464kb | C++23 | 714b | 2025-01-17 19:40:50 | 2025-01-17 19:40:51 |
Judging History
answer
#include <bits/stdc++.h>
#define MOD 998244353
#define LL long long
LL L,R;
int B;
std::unordered_map<LL,int> vq[109];
int fd(LL x,int y) {
if(x==0) return 0;
if(y==0) {
if(x==1) return 1;
return 0;
}
auto it=vq[y].find(x);
if(it!=vq[y].end()) return (*it).second;
int as=fd(x-1,y-1)+fd(x+1,y-1);
if(x==1) as++;
as%=MOD;
for(int i=1;1ll*i*i<=x;i++) {
if(x%i) continue;
if(i<x) as=(as+fd(i,y-1))%MOD;
if(1ll*i*i!=x&&(i>1)) as=(as+fd(x/i,y-1))%MOD;
}
vq[y][x]=as;
return as;
}
signed main(void) {
scanf("%lld %lld %d",&L,&R,&B);
for(LL i=L;i<=R;i++) {
printf("%d ",fd(i,B));
}
}
详细
Subtask #1:
score: 6
Accepted
Test #1:
score: 6
Accepted
time: 0ms
memory: 3840kb
input:
1 10 3
output:
4 10 11 13 14 16 15 18 19 16
result:
ok 10 numbers
Test #2:
score: 6
Accepted
time: 1ms
memory: 3840kb
input:
1 10 10
output:
1446 3555 5399 8364 9365 13867 13268 18455 18559 22035
result:
ok 10 numbers
Test #3:
score: 6
Accepted
time: 1ms
memory: 3840kb
input:
1 10 1
output:
1 2 1 1 1 1 1 1 1 1
result:
ok 10 numbers
Test #4:
score: 6
Accepted
time: 1ms
memory: 3840kb
input:
4 9 10
output:
8364 9365 13867 13268 18455 18559
result:
ok 6 numbers
Subtask #2:
score: 0
Time Limit Exceeded
Dependency #1:
100%
Accepted
Test #5:
score: 0
Time Limit Exceeded
input:
970000 1000000 40
output:
503190413 403501814 423543367 667735332 309717676 941521375 469059575 651585751 638081530 319769570 829344038 710448046 491906657 837995934 191992080 435477208 965318020 224310119 82608430 311469551 397529653 845900371 993051834 218739898 720518121 555742487 850145833 86074414 994934100 233037792 83...
result:
Subtask #3:
score: 0
Skipped
Dependency #2:
0%
Subtask #4:
score: 12
Accepted
Test #11:
score: 12
Accepted
time: 16ms
memory: 3968kb
input:
3000000000 3000000000 4
output:
194829
result:
ok 1 number(s): "194829"
Test #12:
score: 12
Accepted
time: 50ms
memory: 4464kb
input:
2677114440 2677114440 4
output:
3247949
result:
ok 1 number(s): "3247949"
Test #13:
score: 12
Accepted
time: 0ms
memory: 3840kb
input:
559172255 559172255 3
output:
87
result:
ok 1 number(s): "87"
Test #14:
score: 12
Accepted
time: 0ms
memory: 3840kb
input:
1829400271 1829400271 2
output:
5
result:
ok 1 number(s): "5"
Test #15:
score: 12
Accepted
time: 0ms
memory: 3840kb
input:
249371392 249371392 1
output:
1
result:
ok 1 number(s): "1"
Subtask #5:
score: 0
Skipped
Dependency #3:
0%
Subtask #6:
score: 0
Skipped
Dependency #5:
0%
Subtask #7:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%