题目链接

/*
两次排序,搞定
*/
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
struct node {
int key;
double sum;
bool operator <(const node& para) const {
if (sum > para.sum )return true;
else if (sum == para.sum) {
if (key > para.key) return true;
else return false;
}else return false;
}
}arr[];
bool cmp(node a, node b) {
return a.key > b.key;
}
int main() {
int n,m ,k;
while (cin>>n>>m>>k) {
memset(arr, , sizeof(arr));
for (int i=; i<n; i++) {
for (int j=; j<m; j++) {
double tmp;
scanf("%lf", &tmp);
arr[j].sum += tmp;
arr[j].key = j;
}
}
sort(arr, arr+m);
sort(arr, arr+k, cmp);
printf("%d", arr[].key + );
for (int i=; i<k; i++) {
printf(" %d",arr[i].key + );
}
printf("\n");
}
return ;
}

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

  1. 【HDOJ】1031 Design T-Shirt

    qsort直接排序. #include <stdio.h> #include <string.h> #include <stdlib.h> #define MAXN ...

  2. HDU 1031 Design T-Shirt

    http://acm.hdu.edu.cn/showproblem.php?pid=1031 题意 :n个人,每个人对m件衣服打分,每个人对第 i 件衣服的打分要加起来,选取和前 k 高的输出他们的编 ...

  3. 杭电 HDU 1031 Design T-Shirt

    Design T-Shirt Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) T ...

  4. HDU 1031.Design T-Shirt【结构体二次排序】【8月21】

    Design T-Shirt Problem Description Soon after he decided to design a T-shirt for our Algorithm Board ...

  5. 【English】七、常见动词

    一.动词: touch.hear.say.listen touch [tʌtʃ] 触摸 I touch the cat. They touch the elephant. hear  [hɪr] 听到 ...

  6. 最近点对问题 POJ 3714 Raid && HDOJ 1007 Quoit Design

    题意:有n个点,问其中某一对点的距离最小是多少 分析:分治法解决问题:先按照x坐标排序,求解(left, mid)和(mid+1, right)范围的最小值,然后类似区间合并,分离mid左右的点也求最 ...

  7. hdu 1031 (partial sort problem, nth_element, stable_partition, lambda expression) 分类: hdoj 2015-06-15 17:47 26人阅读 评论(0) 收藏

    partial sort. first use std::nth_element to find pivot, then use std::stable_partition with the pivo ...

  8. quoit design(hdoj p1007)

    Problem Description Have you ever played quoit in a playground? Quoit is a game in which flat rings ...

  9. Hdoj 1007 Quoit Design 题解

    Problem Description Have you ever played quoit in a playground? Quoit is a game in which flat rings ...

  10. 【HDOJ】P1007 Quoit Design (最近点对)

    题目意思很简单,意思就是求一个图上最近点对. 具体思想就是二分法,这里就不做介绍,相信大家都会明白的,在这里我说明一下如何进行拼合. 具体证明一下为什么只需要检查6个点 首先,假设当前左侧和右侧的最小 ...

随机推荐

  1. Redis3.2.8配置参数及说明

    bind 127.0.0.1# 绑定的主机地址,不设置默认将处理所有请求protected-mode yes# 是否开启保护模式,默认开启,要是配置里面没有指定bind和密码,开启该参数后,redis ...

  2. NodeJS 加入windows7服务 开机运行 nssm

    from:http://blog.sina.com.cn/s/blog_5ef5f2630101aql8.html 首先需要到http://nssm.cc/download/?page=downloa ...

  3. VS 无法调试 IIS

    用附加的方式断点无效时.   解决方案: 一.VS设置的  .Net版本 与 IIS应用程序池的版本  不一致.   操作步骤: 1. 在VS-> 项目属性, 配置 自定义Web服务器 , 这里 ...

  4. Android:日常学习笔记(8)———开发微信聊天界面

    Android:日常学习笔记(8)———开发微信聊天界面 只做Nine-Patch图片 Nine-Patch是一种被特殊处理过的PNG图片,能够指定哪些区域可以被拉升,哪些区域不可以.

  5. UI控件之UITabBarController

    UITabBarController:标签栏控制器,继承自UIViewController,用标签栏的形式管理视图控制器,各标签栏对应的视图控制器之间相互独立,互不影响,单击标签栏,显示标签栏对应的视 ...

  6. LeetCode: Keyboard Row

    代码长了些,但还是比较简单的 public class Solution { public String[] findWords(String[] words) { List<String> ...

  7. 外网IP地址API

    新浪的IP地址查询接口:http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js 新浪多地域测试方法:http://int.dpool. ...

  8. Cgroups控制cpu,内存,io示例【转】

    本文转载自:https://www.cnblogs.com/yanghuahui/p/3751826.html 百度私有PaaS云就是使用轻量的cgoups做的应用之间的隔离,以下是关于百度架构师许立 ...

  9. 同类型元素,只有一个被选中js

    <div class="wrap-box flex_row"> <div class="wrap-block"> <div cla ...

  10. RabbitMQ死信队列

    关于RabbitMQ死信队列 死信队列 听上去像 消息“死”了     其实也有点这个意思,死信队列  是 当消息在一个队列 因为下列原因: 消息被拒绝(basic.reject/ basic.nac ...