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. Android之判断当前网络状态

    /** * 检测网络是否可用 * @return */ public boolean isNetworkConnected() { ConnectivityManager cm = (Connecti ...

  2. POJ 1270 Following Orders

    Following Orders Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 4902   Accepted: 1982 ...

  3. 解决:HTTP 错误 404.2 - Not Found. 由于 Web 服务器上的“ISAPI 和 CGI 限制”列表设置,无法提供您请求的页面

    错误重现: 在发布网站的过程中,虽然不是第一次发布了,但是还是遇到了很多的问题.为了以后可以轻松解决此类问题还是积累下来比较好. 问题:HTTP 错误 404.2 - Not Found. 由于 We ...

  4. data-stream-as-disjoint-intervals

    https://leetcode.com/problems/data-stream-as-disjoint-intervals/ /** * Definition for an interval. * ...

  5. 分享七个绚丽夺目的JQuery导航(还有苹果、猪八戒等),有图有真相

    今天来一起看看几个个人觉得比较好的导航.有好几个导航是仿的,比如仿苹果.仿猪八戒等等,但仿得还都不错.也有不少是基于jQuery的.特别是像我这样的懒人,就可以在这些基础上修修改改作为自己网站项目的导 ...

  6. 升级iOS10后http网页定位失效解决方案

    最近我们在做项目时遇到这样一个新问题,用户在升级 iOS10 后,在 http 下使用 geolocation api 会报错,控制台输出 [blocked] Access to geolocatio ...

  7. Android界面设计之对话框——定制Toast、AlertDialog

    一.概述 在界面设计中需要根据用户操作显示提示信息.出错信息等,就要用到对话框.Android实现提示信息显示常用有两种方式 1.Toast 2.AlertDialog 二.Toast Android ...

  8. Splunk的安装与使用

    一.简单介绍         Splunk 是机器数据的引擎.使用 Splunk 可收集.索引和利用全部应用程序.server和设备(物理.虚拟和云中)生成的高速移动型计算机数据 .从一个位置搜索并分 ...

  9. PS-点击选中某一个图层

    需要点击选中某一图层的时候,需要勾选[自动选择]

  10. linux主机名的修改

    导读 在一个局域网中,每台机器都有一个主机名,便于主机与主机之间的区分,因此为每台机器设置主机名,以容易记忆的方法来相互访问.比如我们在局域网中可以为根据每台机器的功用来为其命名. 查看主机名命令 [ ...