白书P60 - 硬币问题 完全背包.DP #include <iostream> #include <cstdio> #include <cstring> using namespace std; #define INF 0x3f3f3f3f #define N 1010 int n,s; int w[N]; //w表示n种硬币的面值 int dp1[N]; //dp1[j]表示刚好凑足j的最少硬币数 int dp2[N]; //dp2[j]表示刚好凑足j的最多硬币数…
#include<iostream> #include<cstdio> #include<algorithm> using namespace std; int a[100],ans[100]; void merge_sort(int x,int y) { if(y-x>1) { int mid=x+(y-x)/2; merge_sort(x,mid); merge_sort(mid,y); int i=x,j=mid; int n=mid,m=y,k=0; wh…
Description The widget factory produces several different kinds of widgets. Each widget is carefully built by a skilled widgeteer. The time required to build a widget depends on its type: the simple widgets need only 3 days, but the most complex ones…
Secretary Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 1257 Accepted: 515 Description The basic condition of success of a political party, it is the good Election Programme. PSOS know about it, so they entrust the top secretary Juli…
Sequence Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 6893 Accepted: 1534 Case Time Limit: 2000MS Description Given a sequence, {A1, A2, ..., An} which is guaranteed A1 > A2, ..., An, you are to cut it into three sub-sequences and…
Knights of the Round Table Time Limit: 7000MS Memory Limit: 65536K Total Submissions: 12439 Accepted: 4126 Description Being a knight is a very attractive career: searching for the Holy Grail, saving damsels in distress, and drinking with the oth…
Team Them Up! Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 7608 Accepted: 2041 Special Judge Description Your task is to divide a number of persons into two teams, in such a way, that: everyone belongs to one of the teams; every t…