Design T-Shirt

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 4370    Accepted Submission(s): 2124

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 everybody perfectly satisfied. So he took a poll to collect people's opinions. Here are what he obtained: N people voted for M design elements (such as the ACM-ICPC logo, big names in computer science, well-known graphs, etc.). Everyone assigned each element a number of satisfaction. However, XKA can only put K (<=M) elements into his design. He needs you to pick for him the K elements such that the total number of satisfaction is maximized.
 
Input
The input consists of multiple test cases. For each case, the first line contains three positive integers N, M and K where N is the number of people, M is the number of design elements, and K is the number of elements XKA will put into his design. Then N lines follow, each contains M numbers. The j-th number in the i-th line represents the i-th person's satisfaction on the j-th element.
 
Output
For each test case, print in one line the indices of the K elements you would suggest XKA to take into consideration so that the total number of satisfaction is maximized. If there are more than one solutions, you must output the one with minimal indices. The indices start from 1 and must be printed in non-increasing order. There must be exactly one space between two adjacent indices, and no extra space at the end of the line.
 
Sample Input
3 6 4
2 2.5 5 1 3 4
5 1 3.5 2 2 2
1 1 1 1 1 10
3 3 2
1 2 3
2 3 1
3 1 2
 
Sample Output
6 5 3 1
2 1
 
Author
CHEN, Yue
 
Source
 
Recommend
 
几次排序就可以ac掉...没啥技术...水体
代码:
 #include<iostream>
#include<cstdio>
#include<cstring>
#include<climits>
#include<cstdlib>
#include<algorithm>
#include<vector>
using namespace std; typedef struct Nod
{
int num;
float value;
}nod;
/*二级排序*/
int cmp(nod a,nod b)
{
if(a.value==b.value)
{
return a.num<b.num; //小到大
}
else
return a.value>b.value; //降序大到小
} int Less(int a,int b)
{
return a>b; //降序大到小
}
int main()
{
int n,m,k,i;
float cnt;
while(scanf("%d %d %d",&n,&m,&k)!=EOF)
{
vector<nod>start(m);
vector<int>ans(k);
/*初始化*/
for(i=;i<m;i++)
{
scanf("%f",&start[i].value);
start[i].num=i+;
}
n--;
while(n--)
{
for(i=;i<m;i++)
{
scanf("%f",&cnt);
start[i].value+=cnt;
}
}
sort(start.begin(),start.end(),cmp);
for(i=;i<k;i++)
{
ans[i]=start[i].num;
}
sort(ans.begin(),ans.end(),Less);
printf("%d",ans[]);
for(i=;i<k;i++)
{
printf(" %d",ans[i]);
}
putchar();
}
return ;
}

HDUOJ----(1031)Design T-Shirt的更多相关文章

  1. Tcl与Design Compiler (十三)——Design Compliler中常用到的命令(示例)总结

    本文如果有错,欢迎留言更正:此外,转载请标明出处 http://www.cnblogs.com/IClearner/  ,作者:IC_learner 本文将描述在Design Compliler中常用 ...

  2. Tcl与Design Compiler (五)——综合库(时序库)和DC的设计对象

    本文如果有错,欢迎留言更正:此外,转载请标明出处 http://www.cnblogs.com/IClearner/  ,作者:IC_learner 前面一直说到综合库/工艺库这些东西,现在就来讲讲讲 ...

  3. 小学四则运算结对项目报告(GUI)

    小学四则运算结对项目报告(GUI) 一.Coding.Net项目地址: https://git.coding.net/wsshr/Calculation.git 二.PSP表格(完成前): PSP 任 ...

  4. Design Patterns Simplified - Part 2 (Singleton)【设计模式简述--第二部分(单例模式)】

    原文链接: http://www.c-sharpcorner.com/UploadFile/19b1bd/design-patterns-simplified-part-2-singleton/ De ...

  5. 自适应网页设计(Responsive Web Design)

    引用:http://www.ruanyifeng.com/blog/2012/05/responsive_web_design.html 随着3G的普及,越来越多的人使用手机上网. 移动设备正超过桌面 ...

  6. 领域模型驱动设计(Domain Driven Design)入门概述

    软件开发要干什么: 反映真实世界要自动化的业务流程 解决现实问题 领域Domain Domain特指软件关注的领域 在不能充分了解业务领域的情况下是不可能做出一个好的软件 领域建模 领域模型驱动设计 ...

  7. Scalaz(10)- Monad:就是一种函数式编程模式-a design pattern

    Monad typeclass不是一种类型,而是一种程序设计模式(design pattern),是泛函编程中最重要的编程概念,因而很多行内人把FP又称为Monadic Programming.这其中 ...

  8. 一个Activity掌握Design新控件 (转)

    原文地址:http://blog.csdn.net/lavor_zl/article/details/51295364 谷歌在推出Android5.0的同时推出了全新的设计Material Desig ...

  9. Waves:类Material Design 的圆形波浪(涟漪)点击特效插件

    Waves:类Material Design 的圆形波浪(涟漪)点击特效插件 2014/08/06 分类:前端开发, 素材分享 浏览:6,734次  来源:原创 1个评论       6,734   ...

  10. 自适应网页设计(Responsive Web Design)(转)

    随着3G的普及,越来越多的人使用手机上网. 移动设备正超过桌面设备,成为访问互联网的最常见终端.于是,网页设计师不得不面对一个难题:如何才能在不同大小的设备上呈现同样的网页? 手机的屏幕比较小,宽度通 ...

随机推荐

  1. C++中二维数组的动态分配

    C++中二维数组的动态分配 作者:   来源:csdn博客   公布者:admin 时间:2009-04-23 13:55:03   点击:115 C++中一维数组的动态分配十分经常使用,但C++刚開 ...

  2. Spring Boot中application.yml与bootstrap.yml的区别(转)

    说明:其实yml和properties文件是一样的原理,主要是说明application和bootstrap的加载顺序.且一个项目上要么yml或者properties,二选一的存在. Bootstra ...

  3. 接口处理篇 accept bind connect atan2 htons inet_addr inet_aton inet_ntoa listen ntohl recv send sendto socket

    accept(接受socket连线) 相关函数 socket,bind,listen,connect 表头文件 #include<sys/types.h> #include<sys/ ...

  4. Zabbix iostat 监控配置

    ## zabbix iostat 监控模板安装与配置 配置定时任务,用于生成iostat的统计数据 crontab -e * * * * * /usr/local/zabbix327/bin/iost ...

  5. UNIX 域套接字——UNIX domain socket

    /*********************程序相关信息********************* * 程序编号:015 * 程序编写起始日期:2013.11.30 * 程序编写完成日期:2013.1 ...

  6. Sort List leetcode java

    题目: Sort a linked list in O(n log n) time using constant space complexity. 题解: 考虑到要求用O(nlogn)的时间复杂度和 ...

  7. SQL-重复记录查询的几种方法

    1.查找表中多余的重复记录,重复记录是根据单个字段(peopleId)来判断 select * from people where peopleId in (select peopleId from ...

  8. javascript格式化json显示

    // Example usage: http://jsfiddle.net/q2gnX/ var formatJson = function(json, options) { var reg = nu ...

  9. 转: 用 Eclipse 平台进行 C/C++ 开发

    http://www.ibm.com/developerworks/cn/linux/opensource/os-ecc/index.html

  10. 转:好用 Eclipse插件收集与说明

    http://developer.51cto.com/art/201007/214478.htm