QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#859494#9680. 数字变换lgvc0 0ms0kbC++231008b2025-01-17 19:49:172025-01-17 19:49:18

Judging History

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

  • [2025-01-17 19:49:18]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2025-01-17 19:49:17]
  • 提交

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%