转自:http://www.cnblogs.com/kuangbin/archive/2011/11/12/2246407.html [题目大意] 一条公路上有n个旅馆,选出其中k个设置仓库,一个仓库可服务若干个旅馆,一个旅馆只需一个仓库服务.问在哪几个旅馆设置仓库,每个仓库服务哪些旅馆,可使得旅馆到仓库的总距离最小,并求出总距离(长理只要求求最后一步). 链接:点我 [数据范围] 1 <= n <= 200, 1 <= k <= 30, k <= n [解题思想] 1.此题…
Help Jimmy Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 11071 Accepted: 3607 Description "Help Jimmy" 是在下图所示的场景上完成的游戏. 场景中包括多个长度和高度各不相同的平台.地面是最低的平台,高度为零,长度无限. Jimmy老鼠在时刻0从高于所有平台的某处开始下落,它的下落速度始终为1米/秒.当Jimmy落到某个平台上时,游戏者选择让它向左还是向右…
题意:添加最少的字符使之成为回文串 #include<cstdio> #include<iostream> #include<algorithm> #include<cstring> #include<cmath> #include<queue> using namespace std; ; int n,m,t; short dp[maxn][maxn]; char s[maxn]; int main() { int i,j,k; #…
Description In Pearlania everybody is fond of pearls. One company, called The Royal Pearl, produces a lot of jewelry with pearls in it. The Royal Pearl has its name because it delivers to the royal family of Pearlania. But it also produces bracelets…
Maximum sum Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 38079 Accepted: 11904 Description Given a set of n integers: A={a1, a2,..., an}, we define a function d(A) as below: Your task is to calculate d(A). Input The input consists o…
Palindrome Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 58168 Accepted: 20180 Description A palindrome is a symmetrical string, that is, a string read identically from left to right as well as from right to left. You are to write…
Sumsets Time Limit: 2000MS Memory Limit: 200000K Total Submissions: 15293 Accepted: 6073 Description Farmer John commanded his cows to search for different sets of numbers that sum to a given number. The cows use only numbers that are an integer…
Sumsets Time Limit: 2000MS Memory Limit: 200000K Total Submissions: 15326 Accepted: 6088 Description Farmer John commanded his cows to search for different sets of numbers that sum to a given number. The cows use only numbers that are an integer…