QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#691707 | #8023. The Journey of Geor Autumn | louhao088 | TL | 915ms | 3704kb | C++23 | 628b | 2024-10-31 12:43:26 | 2024-10-31 12:43:27 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define lowbit(i) (i&(-i))
const int mod=998244353,maxn=1e7+5,M=100005;
#define int long long
#define pb push_back
inline int read(){
char ch=getchar();int x=0;bool f=0;
for(;!isdigit(ch);ch=getchar())if(ch=='-')f=1;
for(;isdigit(ch);ch=getchar())x=(x<<1)+(x<<3)+(ch^48);
if(f==1)x=-x;return x;
}
int f[maxn],n,k;
signed main(){
n=read(),k=read();
f[0]=1;
for(int i=1;i<=n;i++){
for(int j=max(0ll,i-k);j<i;j++){
int res=f[j];
for(int l=i-1;l>=j+1;l--)
res=res*l%mod;
f[i]=f[i]+res;
f[i]%=mod;
}
}
cout<<f[n]<<endl;
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3624kb
input:
1 1
output:
1
result:
ok "1"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
1 2
output:
1
result:
ok "1"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
1 3
output:
1
result:
ok "1"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
1 4
output:
1
result:
ok "1"
Test #5:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
2 1
output:
1
result:
ok "1"
Test #6:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
2 2
output:
2
result:
ok "2"
Test #7:
score: 0
Accepted
time: 0ms
memory: 3504kb
input:
2 3
output:
2
result:
ok "2"
Test #8:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
2 4
output:
2
result:
ok "2"
Test #9:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
3 1
output:
1
result:
ok "1"
Test #10:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
3 2
output:
4
result:
ok "4"
Test #11:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
3 3
output:
6
result:
ok "6"
Test #12:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
3 4
output:
6
result:
ok "6"
Test #13:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
4 1
output:
1
result:
ok "1"
Test #14:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
4 2
output:
10
result:
ok "10"
Test #15:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
4 3
output:
18
result:
ok "18"
Test #16:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
4 4
output:
24
result:
ok "24"
Test #17:
score: 0
Accepted
time: 1ms
memory: 3628kb
input:
99 50
output:
955866606
result:
ok "955866606"
Test #18:
score: 0
Accepted
time: 1ms
memory: 3624kb
input:
99 70
output:
296999003
result:
ok "296999003"
Test #19:
score: 0
Accepted
time: 778ms
memory: 3636kb
input:
1034 998
output:
637688669
result:
ok "637688669"
Test #20:
score: 0
Accepted
time: 915ms
memory: 3640kb
input:
1099 997
output:
712935289
result:
ok "712935289"
Test #21:
score: -100
Time Limit Exceeded
input:
10314 998