题目链接

/*
两次排序,搞定
*/
#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. TCP协议的三次握手和四次挥手机制

    核心知识点: 1.三次握手:seq和ack number 2.四次挥手:FIN和随机数 一.TCP/IP协议 TCP/IP协议(Transmission control protool/Interne ...

  2. MyEclipse工具栏的隐藏与显示及自定义

    Myeclipse的工具栏 1.隐藏 工具栏---->右键---->hide toolbar 2.显示     window ----> show toolbar 3.自定义     ...

  3. win10 chrome 调试

      下载NPAPI版本的flash player: http://www.adobe.com/support/flashplayer/debug_downloads.html#fp13       禁 ...

  4. 字典树 trie树 学习

    一字典树 字典树,又称单词查找树,Trie树,是一种树形结构,哈希表的一个变种   二.性质 根节点不包含字符,除根节点以外的每一个节点都只包含一个字符: 从根节点到某一节点,路径上经过的字符串连接起 ...

  5. java PinYinUtils 拼音工具类

    package com.sicdt.library.core.utils; import java.util.HashSet; import java.util.Set; import net.sou ...

  6. iOS获取某个日期后n个月的日期

    一.给一个时间,给一个数,正数是以后n个月,负数是前n个月: -(NSDate *)getPriousorLaterDateFromDate:(NSDate *)date withMonth:(NSI ...

  7. 0731 #Django rest framework

    FBV:Function base viewsdef index(request):    if request.method == 'POST':        return HTTPrespons ...

  8. Django基础知识MTV

    Django简介 Django是使用Python编写的一个开源Web框架.可以用它来快速搭建一个高性能的网站. Django也是一个MVC框架.但是在Django中,控制器接受用户输入的部分由框架自行 ...

  9. 20145239杜文超《网络对抗》- Web基础

    20145239杜文超<网络对抗>- Web基础 基础问题回答 1.什么是表单? 表单是一个包含表单元素的区域. 表单元素是允许用户在表单中(比如:文本域.下拉列表.单选框.复选框等等)输 ...

  10. 使用fastboot刷机流程【转】

    本文转载自:http://www.voidcn.com/blog/Qidi_Huang/article/p-6236224.html [准备工作] 首先需要准备好刷机包,可以是自己编译的,也可以是从别 ...