제14회 화중과학기술대학 프로그래밍대회 결승전
1897 단어 배낭.
//01 ,
#include
using namespace std;
int dp[110][10010],inf;
struct f
{
int v;
int w;
}a[110];
int main()
{
int T;
cin>>T;
inf=1e8;
while(T--)
{
int n,he,i;
memset(dp,0,sizeof(dp));
memset(a,0,sizeof(a));
cin>>n>>he;
int maxx=0;
for(i=0;i>a[i].w>>a[i].v;
maxx=max(maxx,a[i].v);
}
fill(dp[0],dp[0]+n*maxx+1,inf);
dp[0][0]=0;
for(i=0;i
링크:https://www.nowcoder.com/acm/contest/119/F
소 그물
제목 설명
It’s universally acknowledged that there’re innumerable trees in the campus of HUST.
Now HUST got a big land whose capacity is C to plant trees. We have n trees which could be plant in it. Each of the trees makes HUST beautiful which determined by the value of the tree. Also each of the trees have an area cost, it means we need to cost c
i area of land to plant.
We know the cost and the value of all the trees. Now HUSTers want to maximize the value of trees which are planted in the land. Can you help them?
설명 입력:
There are multiple cases.
The first line is an integer T(T≤10), which is the number of test cases.
For each test case, the first line is two number n(1≤n≤100) and C(1≤C≤108), the number of seeds and the capacity of the land.
Then next n lines, each line contains two integer ci(1≤ci≤106) and vi(1≤vi≤100), the space cost and the value of the i-th tree.
출력 설명:
For each case, output one integer which means the max value of the trees that can be plant in the land.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
BZOJ 2427 HAOI 2010 소프트웨어 설치 Tarjan + 트리 DP제목의 대의: 각 점마다 하나의 의존 노드가 있는 그림을 보여 준다. 한 노드를 선택할 때 반드시 이 노드의 의존 노드를 선택해야만 이 노드의 권한을 얻을 수 있다.각 점마다 하나의 공간이 있는데 전체 공간의 제한을...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.