QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#859490 | #9680. 数字变换 | lgvc | 6 | 1290ms | 323400kb | C++23 | 1008b | 2025-01-17 19:46:43 | 2025-01-17 19:46:47 |
Judging History
answer
#include <bits/stdc++.h>
#define MOD 998244353
#define LL long long
LL L,R;
int B,vq[52][1000009];
std::vector<int> tq[5000009];
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<=1000000) {
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<=1000000;i++) {
for(int j=2*i;j<=1000000;j+=i) {
tq[j].push_back(i);
}
}
for(LL i=L;i<=R;i++) {
printf("%d ",fd(i,B));
}
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 6
Accepted
Test #1:
score: 6
Accepted
time: 760ms
memory: 321824kb
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: 754ms
memory: 323272kb
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: 760ms
memory: 323400kb
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: 774ms
memory: 321864kb
input:
4 9 10
output:
8364 9365 13867 13268 18455 18559
result:
ok 6 numbers
Subtask #2:
score: 0
Wrong Answer
Dependency #1:
100%
Accepted
Test #5:
score: 0
Wrong Answer
time: 1290ms
memory: 322888kb
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:
wrong answer 29972nd numbers differ - expected: '468448705', found: '468448707'
Subtask #3:
score: 0
Skipped
Dependency #2:
0%
Subtask #4:
score: 0
Runtime Error
Test #11:
score: 0
Runtime Error
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:
100%
Accepted
Dependency #2:
0%