杭电1004

#include<stdio.h>
#include<string.h>
char a[1000][16];//建立二维数组
static int b[1000];//建立存储对应字符串出现的次数
int main()
{
         int i,j,max,n,m;
         while(scanf("%d",&n)!=EOF){
                   getchar();
                   if(n==0) break;
                   for(i=1;i<=n;i++)
                   {
                            b[i]=0;
                            scanf("%s",a[i]);
                   }
                   for(i=1;i<=n;i++)
                   {
                            for(j=1;j<=n;j++)
                            {
                                     if(strcmp(a[i],a[j])==0)
                                     b[i]++;
                            }
                   }
                   m=1;
                   max=b[1];
                   for(i=2;i<=n;i++)
                   {
                            if(b[i]>max)
                            {
                                     max=b[i];
                                     m=i;
                            }
                   }
                   printf("%s\n",a[m]);
         }
         return 0;
}

时间: 2024-09-27 04:23:34

杭电1004的相关文章

杭电1004 Let the Balloon Rise

Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 120507    Accepted Submission(s): 47270 Problem Description Contest time again! How excited it is to see balloons floating ar

啊啊啊啊啊啊啊啊啊啊啊真是刷了一道有意义的题哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈 杭电1004

输入字符串,并比较输入频率最大的那个字符串 #include<iostream> using namespace std; int main( ) { int round; cin >> round; while (round) { char ballo[1001][16]; int fre[1001] = { 0}; char tem[15]; int m = 0, n = 0; int count = 0; for (int i = 0; i < round; i++)

HDU 4864 Task (贪心+STL多集(二分)+邻接表存储)(杭电多校训练赛第一场1004)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4864 解题报告:有n台机器用来完成m个任务,每个任务有一个难度值和一个需要完成的时间,每台机器有一个可以工作的最长时间和一个可以完成的任务的难度的最大值, 一台机器能完成一个任务的条件是这台机器的最长工作时间和能完成任务的难度值必须都大于等于这个任务,而且一台机器最多完成一个任务,假设一个任务的时间为t,难度值为x,那么完成这个任务可以赚到的钱 money = 500 * t + 2 * x; 现在

杭电ACM分类

杭电ACM分类: 1001 整数求和 水题1002 C语言实验题——两个数比较 水题1003 1.2.3.4.5... 简单题1004 渊子赛马 排序+贪心的方法归并1005 Hero In Maze 广度搜索1006 Redraiment猜想 数论:容斥定理1007 童年生活二三事 递推题1008 University 简单hash1009 目标柏林 简单模拟题1010 Rails 模拟题(堆栈)1011 Box of Bricks 简单题1012 IMMEDIATE DECODABILITY

杭电ACM题目分类

杭电ACM题目分类 基础题:1000.1001.1004.1005.1008.1012.1013.1014.1017.1019.1021.1028. 1029.1032.1037.1040.1048.1056.1058.1061.1070.1076.1089.1090.1091.1092. 1093.1094.1095.1096.1097.1098.1106.1108.1157.1163.1164.1170.1194.1196. 1197.1201.1202.1205.1219.1234.123

【转】对于杭电OJ题目的分类

[好像博客园不能直接转载,所以我复制过来了..] 1001 整数求和 水题1002 C语言实验题——两个数比较 水题1003 1.2.3.4.5... 简单题1004 渊子赛马 排序+贪心的方法归并1005 Hero In Maze 广度搜索1006 Redraiment猜想 数论:容斥定理1007 童年生活二三事 递推题1008 University 简单hash1009 目标柏林 简单模拟题1010 Rails 模拟题(堆栈)1011 Box of Bricks 简单题1012 IMMEDI

杭电 HDU ACM 1212 Big Number

Big Number Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 5606    Accepted Submission(s): 3903 Problem Description As we know, Big Number is always troublesome. But it's really important in ou

2019 杭电多校 第五场

2019 Multi-University Training Contest 5 补题链接:2019 Multi-University Training Contest 5 罚时爆炸 自闭场 1004 equation (HDU 6627) 题意: 给定一个整数 \(C\) 和 \(N\) 组 \(a_i,b_i\),求 \(∑_{i=1}^N|a_i\cdot x + b_i| = C\) 的所有解,如果有无穷多个解就输出 -1. 思路 分类讨论 分类讨论去绝对值.根据 \(b_i / a_i

杭电 HDU 1164 Eddy&#39;s research I

Eddy's research I Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 7117    Accepted Submission(s): 4268 Problem Description Eddy's interest is very extensive, recently  he is interested in prime