P1855 extract kkksc03, p1855 extract kkksc03
Description
The following are all real stories.
Logo2's team functions are hard to achieve by any other oj and tools. With the powerful server resources of Luogu, any school can build oj at zero cost on Luogu and complete training programs efficiently.
Why is oj built? Why is efficiency?
Because you can upload private questions that are invisible to others outside the team. We can also help you evaluate it!
You can create a job, assign tasks to the team members, view the completion status of the team members, and comment on any piece of code!
You can create a competition! It can be oi or acm! It can be a private competition within the team, an open competition, or even a designated person. In this way, the "x League" is the most suitable. With this feature, Luogu hopes to provide another platform for public and private competitions.
It is worth noting that this competition adopts the private question of the team + invitation mechanism.
The operation group of Luogu decides that if an oier recommends Luogu to his coach and can be used successfully (the successful use is defined as: The team has 20 or more members, upload more than 10 private questions, assign a assignment and successfully hold a public competition ), then he can waste some time of kkksc03 while consuming some money of kkksc03 to satisfy his wish.
Kkksc03 has limited time and money, so it is difficult for him to satisfy the wishes of all students. So he wants to know how many students wish to complete at most within his ability range?
Input/Output Format
Input Format:
The first line, n m t, indicates a total of n (n <= 100) wishes, kkksc03 hand M (M <= 200) yuan, he has T (T <= 200) minutes in his summer vacation.
2nd ~ N + 1 rows of mi, ti indicates the time and money required for the I desire.
Output Format:
One row and one number indicates the maximum number of wishes that kkksc03 can fulfill.
Input and Output sample
Input example #1:
6 10 101 12 3 3 22 55 24 3
Output sample #1:
4
Description
Number 1, 2, 3, and 6
3D DP
1 # include <iostream> 2 # include <cstdio> 3 # include <cstring> 4 # include <cmath> 5 using namespace std; 6 struct node 7 {8 int t; // required time 9 int mon; // required money 10} a [1001]; 11 int maxt, maxmon; 12 int dp [120] [201] [201]; 13 int main () 14 {15 int n; 16 scanf ("% d", & n, & maxmon, & maxt ); 17 for (int I = 1; I <= n; I ++) 18 scanf ("% d", & a [I]. t, & a [I]. mon); 19 for (int I = 1; I <= n; I ++) 20 for (int j = 0; j <= maxmon; j ++) 21 for (int k = 0; k <= maxt; k ++) 22 if (a [I]. mon <= j & a [I]. t <= k) 23 dp [I] [j] [k] = max (dp [I-1] [j] [k], dp [I-1] [j-a [I]. mon] [k-a [I]. t] + 1), 24 else25 dp [I] [j] [k] = dp [I-1] [j] [k]; 26 printf ("% d ", dp [n] [maxmon] [maxt]); 27 return 0; 28}