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. jq变态全选vs原生变态全选

    <script> $(function(){ var num=0; $("#btn").on('click',function(){ if(this.checked){ ...

  2. 个人对JQuery Proxy()函数的理解

    转载至:http://www.cnblogs.com/acles/archive/2012/11/20/2779282.html JQuery.proxy(function,context): 使用c ...

  3. 获取Graphics对象的方法

    在做自定义控件时或者GDI+的时候经常会遇到获取Graphics实例的问题.一般有三种获取方式 1.从Paint事件的参数中获取.窗体和许多控件都有一个Paint事件,有一个PaintEventArg ...

  4. Balanced Binary Tree [LeetCode]

    Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary ...

  5. IT求职中,笔试、面试的算法准备

    PS:此文章为转载,源地址:http://www.newsmth.net/nForum/#!article/CoderInterview/849     作者应该是在美国进行的笔试面试,感觉面试的的公 ...

  6. 定时器springMVC

  7. 解析Hibernate中的持久化—ORM(转载)

    最近一直在学习Hibernate,首先说一下Hibernate出现的原因吧,Hibernate是因为MVC的分层体系结构的出现,即数据持久层(模型层)的出现,持久层是在MVC三层架构的基础上提出来的, ...

  8. 用cmd命令行导数据

    Imp  hbtest/hbtest@moms file=d:/hj.dmp fromuser=moms touser=hbtest 也可以用PL/SQL Developer "工具&quo ...

  9. LeetCode 6 ZigZag Conversion 模拟 难度:0

    https://leetcode.com/problems/zigzag-conversion/ The string "PAYPALISHIRING" is written in ...

  10. ASP.NET MVC自定义ActionResult实现文件压缩

    有时候需要将单个或多个文件进行压缩打包后在进行下载,这里我自定义了一个ActionResult,方便进行文件下载 using System; using System.Collections; usi ...