ps:很简单的一个字符串处理问题..

代码:

#include "stdio.h"
#include "string.h"
int find(int flag[],int k);
int main(){
char ss[][],num[][];
int T,k,i,j,temp,flag[],t;
while(~scanf("%d",&T) && T!=){
k=;
memset(flag,,sizeof(flag));
for(i=;i<T;i++){
scanf("%s",&ss[i]);
if(k==){
strcpy(num[k],ss[i]);
flag[k]++;
k++;
}
else{
temp=;
for(j=;j<k;j++){
if(strcmp(num[j],ss[i])==){
temp=;
flag[j]++;
}
}
if(temp==){
strcpy(num[k],ss[i]);
flag[k]++;
k++;
}
}
}
t=find(flag,k);
printf("%s\n",num[t]);
}
return ;
}
int find(int flag[],int k){
int i,max=,temp=;
for(i=;i<k;i++){
if(flag[i]>max){
max=flag[i];
temp=i;
}
}
return temp;
}

Hdu 1004的更多相关文章

  1. HDU 1004 Let the Balloon Rise【STL<map>】

    Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Oth ...

  2. hdu 1004 Let the Balloon Rise(字典树)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1004 Let the Balloon Rise Time Limit: 2000/1000 MS (J ...

  3. HDU 1004 Let the Balloon Rise(map的使用)

    传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1004 Let the Balloon Rise Time Limit: 2000/1000 MS (J ...

  4. hdu 1004 Let the Balloon Rise 解题报告

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1004 用STL 中的 Map 写的 #include <iostream> #includ ...

  5. hdu 1004 Let the Balloon Rise

    Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Oth ...

  6. HDU 1004 Let the Balloon Rise map

    Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Oth ...

  7. HDU 1004 Let the Balloon Rise(AC代码)

    #include <stdio.h> #include <string.h> ][]; ]={}; int main() { int n,i,j,k,max,loc; ){ m ...

  8. HDU 1004 ballons(map)

    题意:输出颜色最多的那个颜色. 思路:水题一道. #include <iostream> #include <string> #include <map> #inc ...

  9. HDU 1004 - Let the Balloon Rise(map 用法样例)

    Problem Description Contest time again! How excited it is to see balloons floating around. But to te ...

随机推荐

  1. PHP弱类型需要特别注意的问题

    下面介绍的问题都已验证, 总结:字符数据比较==不比较类型,会将字符转数据,字符转数字(转换直到遇到一个非数字的字符.即使出现无法转换的字符串,intval()不会报错而是返回0).0e,0x开头的字 ...

  2. Nginx+php+fastcgi在win7下的配置

    首先装载php 1.从www.php.net上下载php对应版本 2.解压之后放到c盘下(其实放哪无所谓,Apache会有配置指向,但是Nginx不用) 3.因为用的5.3.17版本,已经有了php- ...

  3. CodeForces #363 div2 Vacations DP

    题目链接:C. Vacations 题意:现在有n天的假期,对于第i天有四种情况: 0  gym没开,contest没开 1  gym没开,contest开了 2 gym开了,contest没开 3 ...

  4. Android系统的架构

    android的系统架构和其操作系统一样,采用了分层的架构.从架构图看,android分为四个层,从高层到低层分别是应用程序层.应用程序框架层.系统运行库层和linux核心层. 1.应用程序 Andr ...

  5. SQL指定字段指定顺序排序

    SELECT * FROM [ProjectInfo]ORDER BY (CASE DepartmentName WHEN 'AAA' THEN 1 WHEN 'BBB' THEN 2 WHEN 'C ...

  6. linux下关于Apache设置二级域名绑定二级目录的方法

    背景:对于一些论坛网站,某些目录需要制定二级域名去访问,这时候就要在apache中用二级域名绑定二级目录. 方法: 1.首先你要找到apache安装路径,在apahce安装路径下的conf文件夹中找到 ...

  7. php foreach 语法的遍历来源数组如果不是一个有效数组php会出现错误警告 Invalid argument supplied for foreach()

    在php中,foreach语法的遍历来源数组如果不是一个有效数组,php会出现错误警告 Invalid argument supplied for foreach() ,但是很多时候这个数组是取自某些 ...

  8. GestureDetectorl监听

    package com.example.gesturedetectorinterface; /** * write by harvic * 2014-9-25 * blog.csdn.net/harv ...

  9. Devexpress - office - 效果

    项目开发时需要设计好看的UI界面,因公司使用Devexpress控件,因此用到了Devexpress自带的office效果 具体案例 新建一个RibbonForm模版 删除clientPanel(不删 ...

  10. 根据序列图像聚焦区域获取深度 Shape From Focus

    最为超新新新新鸟...我也不知道第一篇文章应该写什么..所以,把自己最近正在研究的东西报一下吧, 研究的东西其实也不算深奥,就是对一个图像序列中的每张图像进行检测,发现每张图片的聚焦清晰区域,找到这个 ...