QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#859494 | #9680. 数字变换 | lgvc | 0 | 0ms | 0kb | C++23 | 1008b | 2025-01-17 19:49:17 | 2025-01-17 19:49:18 |
answer
#include <bits/stdc++.h>
#define MOD 998244353
#define LL long long
LL L,R;
int B,vq[52][5000109];
std::vector<int> tq[5000109];
int fd(LL x,int y) {
if(x==0) return 0;
if(y==0) {
if(x==1) return 1;
return 0;
}
if(vq[y][x]!=-1) return vq[y][x];
int as=fd(x-1,y-1)+fd(x+1,y-1);
if(x==1) as++;
as%=MOD;
if(x<=5000100) {
for(int i=0;i<tq[x].size();i++) {
as=(as+fd(tq[x][i],y-1))%MOD;
}
} else {
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) {
memset(vq,-1,sizeof(vq));
scanf("%lld %lld %d",&L,&R,&B);
for(int i=1;i<=5000100;i++) {
for(int j=2*i;j<=5000100;j+=i) {
tq[j].push_back(i);
}
}
for(LL i=L;i<=R;i++) {
printf("%d ",fd(i,B));
}
}
详细
Subtask #1:
score: 0
Memory Limit Exceeded
Test #1:
score: 0
Memory Limit Exceeded
input:
1 10 3
output:
4 10 11 13 14 16 15 18 19 16
result:
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Skipped
Dependency #2:
0%
Subtask #4:
score: 0
Memory Limit Exceeded
Test #11:
score: 0
Memory Limit Exceeded
input:
3000000000 3000000000 4
output:
result:
Subtask #5:
score: 0
Skipped
Dependency #3:
0%
Subtask #6:
score: 0
Skipped
Dependency #5:
0%
Subtask #7:
score: 0
Skipped
Dependency #1:
0%