Sicily 1453. Conformity
来源:互联网 发布:越南经济数据网站 编辑:程序博客网 时间:2024/06/11 00:01
1453. Conformity
Constraints
Time Limit: 2 secs, Memory Limit: 32 MB
Description
Frosh commencing their studies at Waterloo have diverse interests, as evidenced by their desire to take various combinations of courses from among those available.
University administrators are uncomfortable with this situation, and therefore wish to offer a conformity prize to frosh who choose one of the most popular combinations of courses. How many frosh will win the prize?
Input
The input consists of several test cases followed by a line containing 0. Each test case begins with an integer 1 ≤ n ≤ 10000, the number of frosh. For each frosh, a line follows containing the course numbers of five distinct courses selected by the frosh. Each course number is an integer between 100 and 499.
Output
The popularity of a combination is the number of frosh selecting exactly the same combination of courses. A combination of courses is considered most popular if no other combination has higher popularity. For each line of input, you should output a single line giving the total number of students taking some combination of courses that is most popular.
Sample Input
3100 101 102 103 488100 200 300 101 102103 102 101 488 1003200 202 204 206 208123 234 345 456 321100 200 300 400 4440
Sample Output
23
// Problem#: 1453// Submission#: 3312955// The source code is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License// URI: http://creativecommons.org/licenses/by-nc-sa/3.0/// All Copyright reserved by Informatic Lab of Sun Yat-sen University#include <iostream>#include <vector>#include <algorithm>#include <stdio.h>#include <math.h>#include <string.h>#include <string>#include <queue>#include <set>#include <iomanip>#include <map>using namespace std;int main() { std::cout.sync_with_stdio(false); string temp; while (1) { int n; cin >> n; int MAX = -1; if (n == 0) break; map<long long int, int> counter; for (int i = 0; i < n; i++) { int a[5]; for (int j = 0; j < 5; j++) cin >> a[j]; sort(a, a + 5); long long int temp = 0; for (int j = 0; j < 5; j++) temp = temp * 1000 + a[j]; if (counter.find(temp) == counter.end()) counter[temp] = 1; else counter[temp]++; MAX = max(counter[temp], MAX); } int ans = 0; for (map<long long int, int>::iterator iter = counter.begin(); iter != counter.end(); iter++) if (iter->second == MAX) ans += iter->second; cout << ans << endl; } return 0;}
- Sicily 1453. Conformity
- 【hash】Conformity
- POJ 3640 Conformity
- UVa 11286 - Conformity
- POJ 3640 Conformity(Hash)
- POJ 3640 Conformity 可能会
- Sicily 1027
- sicily 1007
- sicily 1795
- sicily 1036
- sicily 1419
- sicily 1889
- sicily 1684
- sicily 1686
- sicily 1004
- sicily 1135
- sicily 1152
- sicily 1151
- 【JAVA】点名小系统
- swift开发基础之变量和常量
- Sicily 1463. The Brave Sir Robin’s cAsE cOrReCtOr
- Core Data 属性介绍
- LayoutInflater
- Sicily 1453. Conformity
- 第二周项目4-时间类
- 第二周上机时间项目3——时间类
- 自总结shell
- Sicily 1450. Tour de France
- poj 2251 Dungeon Master 【BFS】
- poj2873 Til the Cows Come Home
- linux之间文件传输(转)
- [译]【Storm入门指南】第四章 Spouts