QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#643008 | #53. Boom! | test123 | 100 ✓ | 8ms | 11760kb | C++14 | 1.0kb | 2024-10-15 17:50:49 | 2024-10-15 17:50:50 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int maxn=1005;
const int mod=10301;
int read(){
int ret=0,f=1;char ch=getchar();
while(!isdigit(ch)){if(ch=='-')f=-f;ch=getchar();}
while( isdigit(ch)){ret=(ret<<3)+(ret<<1)+(ch&15);ch=getchar();}
return ret*f;
}
int n,A,B,ans;
int g1[maxn][maxn],g2[maxn][maxn],f1[maxn],f2[maxn];
int main(){
n=read();A=read();B=read();
for(int i=A;i<=n;++i) g1[0][i]=1;
for(int i=A;i<=n;++i){
for(int j=1;j<=i;++j){
g1[i][j]=(g1[i][j]+g1[i-j][j])%mod;
}
for(int j=1;j<=n;++j){
if(i+j<=n) f1[i+j]=(f1[i+j]+g1[i][j])%mod;
g1[i][j]=(g1[i][j]+g1[i][j-1])%mod;
}
}
f1[A]=1;
for(int i=B;i<=n;++i) g2[0][i]=1;
for(int i=B;i<=n;++i){
for(int j=1;j<=i;++j){
g2[i][j]=(g2[i][j]+g2[i-j][j])%mod;
}
for(int j=1;j<=n;++j){
if(i+j<=n) f2[i+j]=(f2[i+j]+g2[i][j])%mod;
g2[i][j]=(g2[i][j]+g2[i][j-1])%mod;
}
}
f2[B]=1;
for(int i=1;i<=n;++i){
for(int j=1;j<=n;++j){
if(i+j>n) break;
ans=(ans+1ll*f1[i]*f2[j])%mod;
}
}
printf("%d\n",ans);
return 0;
}
详细
Pretests
Final Tests
Test #1:
score: 10
Accepted
time: 0ms
memory: 5888kb
input:
9 1 3
output:
15
result:
ok single line: '15'
Test #2:
score: 10
Accepted
time: 1ms
memory: 5852kb
input:
12 2 2
output:
38
result:
ok single line: '38'
Test #3:
score: 10
Accepted
time: 1ms
memory: 5932kb
input:
22 1 1
output:
3287
result:
ok single line: '3287'
Test #4:
score: 10
Accepted
time: 0ms
memory: 6108kb
input:
47 15 7
output:
41
result:
ok single line: '41'
Test #5:
score: 10
Accepted
time: 0ms
memory: 6072kb
input:
94 2 38
output:
3664
result:
ok single line: '3664'
Test #6:
score: 10
Accepted
time: 0ms
memory: 7420kb
input:
378 1 2
output:
1398
result:
ok single line: '1398'
Test #7:
score: 10
Accepted
time: 5ms
memory: 9756kb
input:
680 271 72
output:
155
result:
ok single line: '155'
Test #8:
score: 10
Accepted
time: 8ms
memory: 11484kb
input:
973 14 23
output:
2535
result:
ok single line: '2535'
Test #9:
score: 10
Accepted
time: 4ms
memory: 9564kb
input:
800 500 141
output:
11
result:
ok single line: '11'
Test #10:
score: 10
Accepted
time: 8ms
memory: 11760kb
input:
998 1 1
output:
9017
result:
ok single line: '9017'