HDU 1031 Design T-Shirt】的更多相关文章

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…
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…
题意是有 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…
最近点问题:二维平面中有n(n很大)个点,求出距离最近的两个点 思路:因为n的值很大,所以暴力和dp都行不通了吧!分治法就挺好的. 将区间一半一半的分开,直到分成只有一个点或两个点的时候! 对于只有两个点的区间,最小值就是这两个点的距离,只有一个点的区间, 最小值就是无穷大.注意还要考虑合并的时候,可能距离最近的两个点, 分别在左右两个不同的区间.对于这种情况的处理如下: mid=(ld+rd)/2; ans = min(solve(ld, mid), solve(mid+1, rd));得到两…
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.…
qsort直接排序. #include <stdio.h> #include <string.h> #include <stdlib.h> #define MAXNUM 1000 typedef struct { int index; double statis; } node_st; node_st nodes[MAXNUM]; int comp1(const void *a, const void *b) { node_st *p = (node_st *)a; n…
#include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #include<cmath> #include<stack> #include<string> #include<queue> using namespace std; ; const long long INF = 0xfffffff; struct Point…
链接:第二次小练 这次是我们这组出的题目~我出了一道......B-Prison rearrangement,感觉有点复杂~不过其实题目想通了还是很简单的...... @荆红浅醉出的是A.C.D,@从此不再出的是E——一道很尼玛的二分......题目难懂啊~~~ 这一次很凑巧,大家出的题目的题面都是英文而且....比较长......不过这都是巧合.....= = A.Monkey and Banana HDU 1069 B.Prison rearrangement POJ 1636 题意:就是两…
一.动词: touch.hear.say.listen touch [tʌtʃ] 触摸 I touch the cat. They touch the elephant. hear  [hɪr] 听到 I hear them. He hears you. You hear a child. The girl hears the dog. say [se] 说 She says. He says no. I go say hello. They say no. listen [ˈlɪsən] 听…