Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
拆开就行了#include<stdio.h> #include<string.h> #include<iostream> #define ll __int64 #define N 2000 using namespace std; ll a[N],b[N],inf; int main() { int n,m,j,i,k,l; inf=1; for(i=0;i<18;i++) inf*=10; while(~scanf("%d%d",&m,&n)) { memset(a,0,sizeof(a)); memset(b,0,sizeof(b)); a[0]=1; for(i=1;i<=n;i++) for(j=i;j<=m;j++) { b[j]=b[j]+b[j-i]+(a[j]+a[j-i])/inf; a[j]=(a[j]+a[j-i])%inf; } if(b[m]) printf("%I64d",b[m]); printf("%I64d\n",a[m]); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator