HDU 1031(服装打分 **)】的更多相关文章

题意是有 n 个人要对 m 件服装打分,按总分从高到低排序,再将总分排在前 k 名的服装按编号的从高到低输出,结构体排序. 代码如下: #include <bits/stdc++.h> using namespace std; struct shirt { int num; double price; }t[]; bool cmp1(shirt a,shirt b) { return a.price>b.price; } bool cmp2(shirt a,shirt b) { retu…
http://acm.hdu.edu.cn/showproblem.php?pid=1031 题意 :n个人,每个人对m件衣服打分,每个人对第 i 件衣服的打分要加起来,选取和前 k 高的输出他们的编号 i ,然后这k个的序号要倒序输出 思路 :快排一下就行了.这道题坑了我好几遍TLE,原因是我交的语言是G++而不是C++...... #include <iostream> #include <algorithm> #include <stdio.h> using na…
partial sort. first use std::nth_element to find pivot, then use std::stable_partition with the pivot to partition the largest k, whose indices are in acsending order, print them in reverse order. p.s. lambda expression is also used. STL is powerful.…
Design T-Shirt Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 6527    Accepted Submission(s): 3061 Problem Description Soon after he decided to design a T-shirt for our Algorithm Board on Free…
Design T-Shirt Problem Description Soon after he decided to design a T-shirt for our Algorithm Board on Free-City BBS, XKA found that he was trapped by all kinds of suggestions from everyone on the board. It is indeed a mission-impossible to have eve…
链接:第二次小练 这次是我们这组出的题目~我出了一道......B-Prison rearrangement,感觉有点复杂~不过其实题目想通了还是很简单的...... @荆红浅醉出的是A.C.D,@从此不再出的是E——一道很尼玛的二分......题目难懂啊~~~ 这一次很凑巧,大家出的题目的题面都是英文而且....比较长......不过这都是巧合.....= = A.Monkey and Banana HDU 1069 B.Prison rearrangement POJ 1636 题意:就是两…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1081 http://acm.xmu.edu.cn/JudgeOnline/problem.php?id=1031 题目大意: 给一个n*n(n<=100)的矩阵,求一个矩形覆盖的值最大是多少. 题目思路: [动态规划] 二维的最大字段和.先考虑一维的情况.f[i]=max(f[i-1]+a[i],a[i]) 只要之前的部分和大于零则一起取一定比只取当前位置的要优. 因此只要判断局部段的和是否大于零…
题意: 输入N个数,去掉最大和最小的数,求剩余的数的平均数. 解法: 找到分别最大和最小的数,然后从总和中减去他们,再求平均数(不要排序): 1: #include<stdlib.h> 2: #include<stdio.h> 3: #include<string.h> 4: #include<math.h> 5: #define INF 0x3f3f3f3f 6: int main(){ 7: int n,i; 8: while(scanf("%…
HDU 模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 1049 1050 1057 1062 1063 1064 1070 1073 1075 1082 1083 1084 1088 1106 1107 1113 1117 1119 1128 1129 1144 1148 1157 1161 1170 1172 1177 1197 1200 1201…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2426 For any school, it is hard to find a feasible accommodation plan with every student assigned to a suitable apartment while keeping everyone happy, let alone an optimal one. Recently the president of…