POJ 2535 Very Simple Problem(我的水题之路——看错题)
来源:互联网 发布:淘宝申诉进程在哪看 编辑:程序博客网 时间:2024/04/30 15:13
Very Simple Problem
Time Limit: 2000MS Memory Limit: 65536KTotal Submissions: 3284 Accepted: 1232
Description
During a preparation of programming contest, its jury is usually faced with many difficult tasks. One of them is to select a problem simple enough to most, if not all, contestants to solve.
The difficulty here lies in diverse meanings of the term "simple" amongst the jury members. So, the jury uses the following procedure to reach a consensus: each member weights each proposed problem with a positive integer "complexity rating" (not necessarily different for different problems). The jury member calls "simplest" those problems that he gave the minimum complexity rating, and "hardest" those problems that he gave the maximum complexity rating.
The ratings received from all jury members are then compared, and a problem is declared as "very simple", if it was called as "simplest" by more than a half of the jury, and was called as "hardest" by nobody.
The difficulty here lies in diverse meanings of the term "simple" amongst the jury members. So, the jury uses the following procedure to reach a consensus: each member weights each proposed problem with a positive integer "complexity rating" (not necessarily different for different problems). The jury member calls "simplest" those problems that he gave the minimum complexity rating, and "hardest" those problems that he gave the maximum complexity rating.
The ratings received from all jury members are then compared, and a problem is declared as "very simple", if it was called as "simplest" by more than a half of the jury, and was called as "hardest" by nobody.
Input
The first line of input file contains integers N and P, the number of jury members and the number of problems. The following N lines contain P integers in range from 0 to 1000 each - the complexity ranks. 1 <= N, P <= 100
Output
Output file must contain an ordered list of problems called as "very simple", separated by spaces. If there are no such problems, output must contain a single integer 0 (zero).
Sample Input
4 41 1 1 25 900 21 4010 10 9 103 4 3 5
Sample Output
3
Source
Northeastern Europe 2002, Far-Eastern Subregion
N个评委,P道题目,每个评委对每道题进行评分。对于单个评委来说,如果他评分中的最高分的题目被视为该评委认定的“最困难的题目”,他评分中的最低分的题目被视为该评委认定的“最简单的题目”。对于每一道题,如果没有评委评定为“最困难的题目”,且有超过半数(不等于)的评委评定为“最简单的题目”,则这就可以被认为是“非常简单的题目”。现在请将“非常简单的题目”的题号输出(这个是隐含的信息,按照评委对题目的评定顺序决定,题号从1开始),且用空格间隔。
这道题看题目看了好久好久,因为一开始看错了题目,Description看懂了,不过Input和Output的说明没有看清楚,导致样例一直看不懂,重复看了很多遍Description,但是没有仔细研究Input和Output的内容,纠结了我两个小时(T_T)。
注意点:
1)仔细看题,不仅仅是Description、Input、Output都要仔细看懂。
代码(1AC):
#include <cstdio>#include <cstdlib>#include <cstring>int N, P;int arr[110];int easy[110];int hard[110];int main(void){ int i, j; int tmp, flag; int min, max; while (scanf("%d%d", &N, &P) != EOF){ memset(easy, 0, sizeof(easy)); memset(hard, 0, sizeof(hard)); for (i = 0; i < N; i++){ min = 10000; max = -1; for (j = 0; j < P; j++){ scanf("%d", &arr[j]); if (min > arr[j]){ min = arr[j]; } if (max < arr[j]){ max = arr[j]; } } for (j = 0; j < P; j++){ if (arr[j] == min){ easy[j]++; } if (arr[j] == max && !hard[j]){ hard[j] = 1; } } } /* for (i = 0; i < P; i++){ printf("%d ", hard[i]); } printf("\n"); for (i = 0; i < P; i++){ printf("%d ", easy[i]); } printf("\n");*/ flag = 0; for (i = 0; i < P; i++){ if (easy[i] > N / 2 && hard[i] == 0){ if (flag){ printf(" "); } printf("%d", i + 1); flag = 1; } } if (flag == 0){ printf("0\n"); } else{ printf("\n"); } } return 0;}
- POJ 2535 Very Simple Problem(我的水题之路——看错题)
- POJ 2535 Very Simple Problem(水~)
- POJ 2535 Very Simple Problem
- poj 2535 Very Simple Problem
- POJ 2535 Very Simple Problem G++
- POJ 3483 A Very Simple Problem
- POJ 2871 A Simple Question of Chemistry(我的水题之路——数列两数之差 )
- POJ 1350 Cabric Number Problem(我的水题之路——字符串和数字间的转换)
- POJ 1298 The Hardest Problem Ever(我的水题之路——解密,水题)
- POJ 1658 Eva's Problem(我的水题之路——等差or等比)
- SGU111 Very simple problem(大数开方)
- 1166 Very Simple Problem
- [Java]Very simple problem
- sgu111:Very simple problem
- 111. Very simple problem
- SGU111 Very simple problem
- ACM刷题之POJ————A Simple Problem with Integers
- POJ 1207 The 3n+1 problem(我的水题之路——输入输出要保持原有顺序)
- CHeaderCtrl用法
- 《设计模式实践指南》意见和建议征集帖
- 那些年,我们一起追的女孩
- 多线程(线程安全、线程间通信、1.5中的Lock)总结2
- 禁用ipv6
- POJ 2535 Very Simple Problem(我的水题之路——看错题)
- hbase0.90.4安装总结
- ISTQB AL-TM连载系列02:确定软件产品发布中的测试因素
- 百度map api for Android~搜索服务
- hibernate调用存储过程
- 堆和栈的区别 (转贴)
- finish、killProcess 使用必知_one App two Activity
- 高并发高流量网站架构
- 通过hibernate去调用存储过程