Design T-Shirt 分类: HDU 2015-06-26 11:58 7人阅读 评论(0) 收藏
Design T-Shirt
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 6744 Accepted Submission(s): 3167
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.
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.
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.
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
6 5 3 1
2 1#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <string>
#include <stack>
#include <algorithm>
using namespace std; const int Max=1100000; struct ELE
{
int num;
double sum;
} E[1100];
int a[1100];
bool cmp1(ELE a,ELE b)
{
if(a.sum>b.sum||(a.sum==b.sum&&a.num<b.num))
return true;
return false;
}
bool cmp2(int a,int b)
{
return a>b;
}
int main()
{
int n,m,k;
double data;
while(~scanf("%d %d %d",&n,&m,&k))
{
for(int i=0; i<n; i++)
{
for(int j=0; j<m; j++)
{
scanf("%lf",&data);
if(i)
{
E[j].sum+=data;
}
else
{
E[j].num=j+1;
E[j].sum=data;
}
}
}
sort(E,E+m,cmp1);
for(int i=0;i<k;i++)
{
a[i]=E[i].num;
}
sort(a,a+k,cmp2);
for(int i=0;i<k;i++)
{
if(i)
cout<<" ";
cout<<a[i];
}
cout<<endl;
}
return 0;
}
版权声明:本文为博主原创文章,未经博主允许不得转载。
Design T-Shirt 分类: HDU 2015-06-26 11:58 7人阅读 评论(0) 收藏的更多相关文章
- UIAlertController高级之嵌入其他控件 分类: ios技术 2015-02-02 11:58 96人阅读 评论(0) 收藏
在编码过程中,我们经常遇到需要这样一个效果,就是弹出框的嵌套; 举个最简单的例子,比如你要选择时间,必然需要一个时间选择器DatePicker.但是这个选择器又是在你点击某按钮时弹出,弹出方式最常见的 ...
- hdu 1057 (simulation, use sentinel to avoid boudary testing, use swap trick to avoid extra copy.) 分类: hdoj 2015-06-19 11:58 25人阅读 评论(0) 收藏
use sentinel to avoid boudary testing, use swap trick to avoid extra copy. original version #include ...
- 百度编辑器UEditor ASP.NET示例Demo 分类: ASP.NET 2015-01-12 11:18 346人阅读 评论(0) 收藏
在百度编辑器示例代码基础上进行了修改,封装成类库,只需简单配置即可使用. 完整demo下载 版权声明:本文为博主原创文章,未经博主允许不得转载.
- Least Common Ancestors 分类: ACM TYPE 2014-10-19 11:24 84人阅读 评论(0) 收藏
#include <iostream> #include <cstdio> #include <cstring> #include <cmath> #i ...
- 二分图匹配(KM算法)n^4 分类: ACM TYPE 2014-10-04 11:36 88人阅读 评论(0) 收藏
#include <iostream> #include<cstring> #include<cstdio> #include<cmath> #incl ...
- short-path problem (Floyd) 分类: ACM TYPE 2014-09-01 23:58 100人阅读 评论(0) 收藏
#include <cstdio> #include <iostream> #include <cstring> using namespace std; cons ...
- Segment Tree with Lazy 分类: ACM TYPE 2014-08-29 11:28 134人阅读 评论(0) 收藏
#include<stdio.h> #include<string.h> #include<algorithm> using namespace std; stru ...
- 8大排序算法图文讲解 分类: Brush Mode 2014-08-18 11:49 78人阅读 评论(0) 收藏
排序算法可以分为内部排序和外部排序,内部排序是数据记录在内存中进行排序,而外部排序是因排序的数据很大,一次不能容纳全部的排序记录,在排序过程中需要访问外存. 常见的内部排序算法有:插入排序.希尔排序. ...
- C语言之void类型及void指针 分类: C/C++ 2015-07-13 11:24 8人阅读 评论(0) 收藏
原文网址:http://www.cnblogs.com/pengyingh/articles/2407267.html 1.概述 许多初学者对C/C 语言中的void及void指针类型不甚理解,因此在 ...
随机推荐
- 1019: A+B和C比大小
1019: A+B和C比大小 时间限制: 1 Sec 内存限制: 128 MB提交: 518 解决: 300[提交][状态][讨论版] 题目描述 给定区间[-231, 231]内的3个整数A.B和 ...
- android adb shell
http://blog.csdn.net/zyp009/article/details/8332925 最快的Android模拟器Genymotion的安装与使用 http://blog.csdn.n ...
- oracle 分区表的维护
1:添加分区: ALTER TABLE SALES ADD PARTITION P3 VALUES LESS THAN(TO_DATE('2003-06-01','YYYY-MM-DD')); SAL ...
- centos中的qt设计师所在的包
由于暂时用不到qt的ide,所以想把它卸了,经过一番查找,其所在的包名是: qt-devel
- [php/html/CSS]给Aptana3 安装 Emmet插件
aptana studio3 安装 zencoding(Emmet) 插件 zen coding 更名为Emmet emmet 谷歌主页地址:http://code.google.com/p/zen- ...
- linux计划任务运行php文件的方法
在linux下,借助crontab,设置计划任务每天6点10分执行filename.php文件,写入一行时间到log日志中. 创建计划任务的脚本: dos2unix /path/to/filename ...
- 如何通过类找到对应的jar包
ctrl+shift+T 然后输入对应类
- Reporting Service报表项默认可见+号和-号的显示问题
在Reporting Service里面可以设置报表项(组.tablix行.tablix列.文本框等所有SSRS报表项)的可见性,并且可以设置某个报表项的可见性由点击另外一个报表项来控制,比如报表项A ...
- SQL server 创建 修改表格 及表格基本增删改查 及 高级查询 及 (数学、字符串、日期时间)函数[转]
SQL server 创建 修改表格 及表格基本增删改查 及 高级查询 及 (数学.字符串.日期时间)函数 --创建表格 create table aa ( UserName varchar(50 ...
- TVideoGrabber如何并行处理多摄像头
大家都知道 TVideoGrabber是一款支持包括C#..NET.VB.NET.C++.Delphi.C++Builder和ActiveX平台在内的视频处理控件,可以捕捉视频,也可以作为多媒体播放器 ...