QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#752674#53. Boom!I_be_wanna100 ✓16ms11700kbC++205.4kb2024-11-16 09:11:282024-11-16 09:11:29

Judging History

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

  • [2024-11-16 09:11:29]
  • 评测
  • 测评结果:100
  • 用时:16ms
  • 内存:11700kb
  • [2024-11-16 09:11:28]
  • 提交

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;
}
/*#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)){re
#include<iostream>
#include<cstring>
using namespace std;int A[100000],B[100000],C[10000000],temp=0,lena,lenb,lenc;char a[1000000],b[10000000];int main(){cin>>a;cin>>b;lena=strlen(a);lenb=strlen(b);for(int i=0;i<lena;++i)A[i]=a[lena-1-i]-'0';for(int i=0;i<lenb;++i)B[i]=b[lenb-1-i]-'0';lenc=lena>lenb?lena:lenb;for(int i=0;i<lenc;++i){C[i]=A[i]+B[i]+temp;temp=C[i]/10;C[i]%=10;}if(temp!=0){C[lenc]=temp;for(int i=lenc;i>=0;--i)cout<<C[i];return 0;}for(int i=lenc-1;i>=0;--i)cout<<C[i];return 0;}#include<iostream>
#include<cstring>
using namespace std;int A[100000],B[100000],C[10000000],temp=0,lena,lenb,lenc;char a[1000000],b[10000000];int main(){cin>>a;cin>>b;lena=strlen(a);lenb=strlen(b);for(int i=0;i<lena;++i)A[i]=a[lena-1-i]-'0';for(int i=0;i<lenb;++i)B[i]=b[lenb-1-i]-'0';lenc=lena>lenb?lena:lenb;for(int i=0;i<lenc;++i){C[i]=A[i]+B[i]+temp;temp=C[i]/10;C[i]%=10;}if(temp!=0){C[lenc]=temp;for(int i=lenc;i>=0;--i)cout<<C[i];return 0;}for(int i=lenc-1;i>=0;--i)cout<<C[i];return 0;}#include<iostream>
#include<cstring>
using namespace std;int A[100000],B[100000],C[10000000],temp=0,lena,lenb,lenc;char a[1000000],b[10000000];int main(){cin>>a;cin>>b;lena=strlen(a);lenb=strlen(b);for(int i=0;i<lena;++i)A[i]=a[lena-1-i]-'0';for(int i=0;i<lenb;++i)B[i]=b[lenb-1-i]-'0';lenc=lena>lenb?lena:lenb;for(int i=0;i<lenc;++i){C[i]=A[i]+B[i]+temp;temp=C[i]/10;C[i]%=10;}if(temp!=0){C[lenc]=temp;for(int i=lenc;i>=0;--i)cout<<C[i];return 0;}for(int i=lenc-1;i>=0;--i)cout<<C[i];return 0;}#include<iostream>
#include<cstring>
using namespace std;int A[100000],B[100000],C[10000000],temp=0,lena,lenb,lenc;char a[1000000],b[10000000];int main(){cin>>a;cin>>b;lena=strlen(a);lenb=strlen(b);for(int i=0;i<lena;++i)A[i]=a[lena-1-i]-'0';for(int i=0;i<lenb;++i)B[i]=b[lenb-1-i]-'0';lenc=lena>lenb?lena:lenb;for(int i=0;i<lenc;++i){C[i]=A[i]+B[i]+temp;temp=C[i]/10;C[i]%=10;}if(temp!=0){C[lenc]=temp;for(int i=lenc;i>=0;--i)cout<<C[i];return 0;}for(int i=lenc-1;i>=0;--i)cout<<C[i];return 0;}#include<iostream>
#include<cstring>
using namespace std;int A[100000],B[100000],C[10000000],temp=0,lena,lenb,lenc;char a[1000000],b[10000000];int main(){cin>>a;cin>>b;lena=strlen(a);lenb=strlen(b);for(int i=0;i<lena;++i)A[i]=a[lena-1-i]-'0';for(int i=0;i<lenb;++i)B[i]=b[lenb-1-i]-'0';lenc=lena>lenb?lena:lenb;for(int i=0;i<lenc;++i){C[i]=A[i]+B[i]+temp;temp=C[i]/10;C[i]%=10;}if(temp!=0){C[lenc]=temp;for(int i=lenc;i>=0;--i)cout<<C[i];return 0;}for(int i=lenc-1;i>=0;--i)cout<<C[i];return 0;}#include<iostream>
#include<cstring>
using namespace std;int A[100000],B[100000],C[10000000],temp=0,lena,lenb,lenc;char a[1000000],b[10000000];int main(){cin>>a;cin>>b;lena=strlen(a);lenb=strlen(b);for(int i=0;i<lena;++i)A[i]=a[lena-1-i]-'0';for(int i=0;i<lenb;++i)B[i]=b[lenb-1-i]-'0';lenc=lena>lenb?lena:lenb;for(int i=0;i<lenc;++i){C[i]=A[i]+B[i]+temp;temp=C[i]/10;C[i]%=10;}if(temp!=0){C[lenc]=temp;for(int i=lenc;i>=0;--i)cout<<C[i];return 0;}for(int i=lenc-1;i>=0;--i)cout<<C[i];return 0;}#include<iostream>
#include<cstring>
using namespace std;int A[100000],B[100000],C[10000000],temp=0,lena,lenb,lenc;char a[1000000],b[10000000];int main(){cin>>a;cin>>b;lena=strlen(a);lenb=strlen(b);for(int i=0;i<lena;++i)A[i]=a[lena-1-i]-'0';for(int i=0;i<lenb;++i)B[i]=b[lenb-1-i]-'0';lenc=lena>lenb?lena:lenb;for(int i=0;i<lenc;++i){C[i]=A[i]+B[i]+temp;temp=C[i]/10;C[i]%=10;}if(temp!=0){C[lenc]=temp;for(int i=lenc;i>=0;--i)cout<<C[i];return 0;}for(int i=lenc-1;i>=0;--i)cout<<C[i];return 0;}#include<iostream>
#include<cstring>
using namespace std;int A[100000],B[100000],C[10000000],temp=0,lena,lenb,lenc;char a[1000000],b[10000000];int main(){cin>>a;cin>>b;lena=strlen(a);lenb=strlen(b);for(int i=0;i<lena;++i)A[i]=a[lena-1-i]-'0';for(int i=0;i<lenb;++i)B[i]=b[lenb-1-i]-'0';lenc=lena>lenb?lena:lenb;for(int i=0;i<lenc;++i){C[i]=A[i]+B[i]+temp;temp=C[i]/10;C[i]%=10;}if(temp!=0){C[lenc]=temp;for(int i=lenc;i>=0;--i)cout<<C[i];return 0;}for(int i=lenc-1;i>=0;--i)cout<<C[i];return 0;}t=(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){
	}
	printf("%d\n",ans);
	return 0;
} */

詳細信息


Pretests


Final Tests

Test #1:

score: 10
Accepted
time: 1ms
memory: 5848kb

input:

9 1 3

output:

15

result:

ok single line: '15'

Test #2:

score: 10
Accepted
time: 1ms
memory: 5928kb

input:

12 2 2

output:

38

result:

ok single line: '38'

Test #3:

score: 10
Accepted
time: 1ms
memory: 6032kb

input:

22 1 1

output:

3287

result:

ok single line: '3287'

Test #4:

score: 10
Accepted
time: 1ms
memory: 6028kb

input:

47 15 7

output:

41

result:

ok single line: '41'

Test #5:

score: 10
Accepted
time: 1ms
memory: 6032kb

input:

94 2 38

output:

3664

result:

ok single line: '3664'

Test #6:

score: 10
Accepted
time: 4ms
memory: 8108kb

input:

378 1 2

output:

1398

result:

ok single line: '1398'

Test #7:

score: 10
Accepted
time: 3ms
memory: 9464kb

input:

680 271 72

output:

155

result:

ok single line: '155'

Test #8:

score: 10
Accepted
time: 15ms
memory: 11580kb

input:

973 14 23

output:

2535

result:

ok single line: '2535'

Test #9:

score: 10
Accepted
time: 6ms
memory: 9492kb

input:

800 500 141

output:

11

result:

ok single line: '11'

Test #10:

score: 10
Accepted
time: 16ms
memory: 11700kb

input:

998 1 1

output:

9017

result:

ok single line: '9017'