标签:io os for sp c amp r size as
# include<stdio.h> # include <algorithm> # include <string.h> # include <iostream> using namespace std; int main() { int n,m,i,j,k; int c1[110],c2[110]; int a[110],b[110]; while(~scanf("%d%d",&n,&m)) { for(i=0;i<n;i++) scanf("%d%d",&a[i],&b[i]); memset(c1,0,sizeof(c1)); memset(c2,0,sizeof(c2)); for(i=a[0];i<=b[0];i++)//第一种水果 c1[i]=1; for(i=1;i<n;i++) { for(j=0;j<=m;j++)//买m种水果组成的拼盘 { for(k=a[i];k<=b[i];k++)//i类水果数量 从a[]到b[] { c2[j+k]+=c1[j]; } } for(j=0;j<=m;j++) { c1[j]=c2[j]; c2[j]=0; } } printf("%d\n",c1[m]); } return 0; }
标签:io os for sp c amp r size as
原文地址:http://blog.csdn.net/lp_opai/article/details/39780343