hdu1004】的更多相关文章

Problem Description Contest time again! How excited it is to see balloons floating around. But to tell you a secret, the judges' favorite time is guessing the most popular problem. When the contest is over, they will count the balloons of each color…
HDU1004 思路:求数组中出现次数最多的那个元素: 遍历数组元素,找出每个元素出现的次数 Input Input contains multiple test cases. Each test case starts with a number N (0 < N <= 1000) -- the total number of balloons distributed. The next N lines contain one color each. The color of a ballo…
#include <stdio.h> #include <string.h> int main() { ][]; int n, i, k, j, max, max_i; ){ // while( n-- ){ #1 /*输入*/ ; i < n; i ++ ) { getchar(); scanf("%s", color[i]); } ) printf(]); else { max = ; /*搜索比较*/ ; i < n - ; i ++ ) {…
Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 108214 Accepted Submission(s): 42023 Problem Description Contest time again! How excited it is to see balloons floating around.…
Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 102132    Accepted Submission(s): 39192 Problem Description Contest time again! How excited it is to see balloons floating ar…
Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 106421 Accepted Submission(s): 41214 Problem Description Contest time again! How excited it is to see balloons floating around.…
这道题是从上个星期开始做的,看到题时觉得似曾相似,好像做过,理了一下思路敲完代码又不对,后来发现是数组用错了,之后又重新想了数组和比较用法,昨天改了一个多小时,后来样例输出全部正确,所有情况都考虑到了,还是WA,今天上午搜了一下代码,测了一下样例,发现当所有输入不一样时,输出一个即可,是我把这种情况考虑多了,我考虑的是当所有输入不一样时,不输出,改完之后立马就AC了,我只想说:我又想多了,,,,,, 题意:给出N组字符串,判断哪一个字符串出现的次数最多,并输出该字符串.当N=0时,表示结束. 输…
Problem Description Contest time again! How excited it is to see balloons floating around. But to tell you a secret, the judges' favorite time is guessing the most popular problem. When the contest is over, they will count the balloons of each color…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1004 题目大意:给你一个数n,要求输入n个字符串,在这n个字符串中,我们需要输出出现次数最多的字符串. 这道题看起来的确很简单,但是却花了我不少时间,开始时是利用C语言中的char数组来存这些字符串,依次统计,但是做了很久都始终有错,于是我便转变思路,利用C++中的string来村字符串. 注意:这里有一个小小的知识点,用string来定义的字符串,最好使用cout来输出,如果用printf函数来输…
2019-02-28-08:56:03 初次做本题是用字符串硬钢,最近校队训练时又遇到才知道用map是真的舒服.需要注意的是map的用法. clear : 清除map中的所有元素,map.clear(); erase: 删除 map 中指定位置的元素:map.erase(map.begin()); insert : 在 map 指定位置添加 pair 类型的元素:map.insert( pair< char, int >('f', 100) ); begin, end : map 的正向迭代器…