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. Centos安装vsftp服务

    1.安装vsftp yum install vsftpd 2.开启vsftp服务,设置开机自启 service vsftpd restart chkconfig vsftpd on 停止vsftpd: ...

  2. 解决Gradle编译时出现: 编码GBK的不可映射字符

    解决Gradle编译时出现: 编码GBK的不可映射字符 在build.gradle文件中加入如下内容: [compileJava, compileTestJava]*.options*.encodin ...

  3. linux命令格式及基础命令(一)

    linux命令格式 ~]#COMMAND [选项] [参数] 例如: ~]#ls 不带任何选项和参数 ``` stylus ~]#ls -lh /etc 列出/etc下所有文件和目录,同时要求以格式和 ...

  4. angularJS问题集结

    1.用ng-repeat循环输出遇到很奇怪的问题 : Error: [ngRepeat:dupes] http://errors.angularjs.org/1.4.6/ngRepeat/dupes? ...

  5. html中给表格添加斜线

    <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...

  6. 关于meta元信息元素

    HTML头部<meta>标记通过属性定义文件的名称.内容.关键词.作者.描述等多种信息,但是只能在源代码中显示,页面上无法显示出来.此标签可以在头部有多个. A.设置页面关键词 基本语法: ...

  7. 我需要在Web上完成一个图片上传的功能(+2)

    增加一个页面,用于判断传参是否正确. @{     //判断是否具备会员参数     if (UrlData.Count > 0)     {         Session["Arg ...

  8. android SDK下载及中文API地址

    中文API:http://wiki.eoeandroid.com/Android_API_Guides Android Dev Tools官网地址:www.androiddevtools.cn 收集整 ...

  9. CSS3学习之分享下transition属性

    最近在网上看到很多transition写的效果,借鉴http://www.w3school.com.cn分享下代码, 1.语法:transition: property duration timing ...

  10. AJAX(一、基本知识)

    AJAX:Asynchronous ([ə'sɪŋkrənəs; eɪ-])Javascript (['dʒɑ:və,skrɪpt])and XML 异步的Javascript和XMLAJAX不是新的 ...