标签:des style blog http color io os ar for
1 #include<iostream> 2 #include<cstdio> 3 using namespace std; 4 int a[110],b[110],f[2000],n,t,k,m,i,j,ans; 5 int main() 6 { 7 cin>>n>>t>>k; 8 m=t*5/4; 9 for(i=1;i<=n;i++) scanf("%d%d",&a[i],&b[i]); 10 for(i=1;i<=n;i++) 11 for(j=0;j<=m-b[i];j++) 12 f[j+b[i]]=max(f[j+b[i]],f[j]+a[i]); 13 for(i=1;i<=m;i++) f[i]=max(f[i],f[i-1]); 14 ans=f[t]; 15 for(i=1;i<=n;i++) 16 if(b[i]>=k) ans=max(ans,a[i]+f[(t-b[i])*5/4]); 17 cout<<ans<<endl; 18 return 0; 19 }
BZOJ2021: [Usaco2010 Jan]Cheese Towers
标签:des style blog http color io os ar for
原文地址:http://www.cnblogs.com/zyfzyf/p/4003648.html