讨论 / 求大神帮小弟看看!!!!!!
liusikai 2013-07-02 04:34:00
点我顶贴 收藏 删除
状态: Unaccepted

测评机: Xeost[5]

得分: 90分

提交日期: 2013-7-2 19:24:00

有效耗时: 453毫秒

测试结果1: 通过本测试点|有效耗时63ms

测试结果2: 通过本测试点|有效耗时46ms

测试结果3: 通过本测试点|有效耗时47ms

测试结果4: 通过本测试点|有效耗时47ms

测试结果5: 通过本测试点|有效耗时47ms

测试结果6: 通过本测试点|有效耗时47ms

测试结果7: 通过本测试点|有效耗时46ms

测试结果8: 通过本测试点|有效耗时63ms

测试结果9: 通过本测试点|有效耗时47ms

#include<stdio.h>

int max(int x,int y)

{

int z;

if(x>y) z=x;

else z=y;

return z;

}

int main()

{

int n,m,i,j;

int c[100],r[100],f[10000]={0};

int max(int x,int y);

scanf("%d%d",&n,&m);

for(i=0;i<n;i++)

{

scanf("%d%d",&c[i],&r[i]);

}

for(i=0;i<n;i++)

{

for(j=0;j<=m;j++)

{

if(j-c[i]>=0)

{

f[j]=max(f[j],f[j-c[i]]+r[i]-2*c[i]);

}

}

}

printf("%d\n",f[m]+m);

return 0;

}

#1 liusikai@2013-07-02 04:34:00
回复 删除
最后一个测试点答案:

我的答案是6152

正确答案345864

查看更多回复
提交回复