Hdu 1004
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的更多相关文章
- 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 ...
- 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 ...
- 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 ...
- hdu 1004 Let the Balloon Rise 解题报告
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1004 用STL 中的 Map 写的 #include <iostream> #includ ...
- hdu 1004 Let the Balloon Rise
Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Oth ...
- 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 ...
- HDU 1004 Let the Balloon Rise(AC代码)
#include <stdio.h> #include <string.h> ][]; ]={}; int main() { int n,i,j,k,max,loc; ){ m ...
- HDU 1004 ballons(map)
题意:输出颜色最多的那个颜色. 思路:水题一道. #include <iostream> #include <string> #include <map> #inc ...
- HDU 1004 - Let the Balloon Rise(map 用法样例)
Problem Description Contest time again! How excited it is to see balloons floating around. But to te ...
随机推荐
- C3P0的两种使用方法
方法一: package C3P0; import java.sql.Connection; import java.sql.SQLException; import java.bea ...
- UnsupportedClassVersionError 错误解决办法
偶然遇到关于版本问题的错误,为了以后查找方便记录下来.有更好的办法欢迎大家更正. 错误内容: Exception in thread "main" java.lang.Unsupp ...
- (转)css3-box-sizing属性详解
box-sizing是CSS3的box属性之一.一说到CSS的盒模型(Box model)我想很多人都会比较烦,特别是对于新手,然而这个Box model又是我们CSS运用中比较重要的一个属性.那么C ...
- 内存分配与Segmentation fault
为了方便使用,我做了如下结构体的嵌套使用: struct operation{ int num; char name[100]; char owner[100]; char msg[100];}; s ...
- 关于BP网络的一些总结
背景 前段时间,用过一些模型如vgg,lexnet,用于做监督学习训练,顺带深入的学习了一下相关模型的结构&原理,对于它的反向传播算法记忆比较深刻, 就自己的理解来描述一下BP网络. 关于BP ...
- RHEL 6.0服务器安装Oracle 11G R2 最终版
RHEL6安装Oracle 11g R2最终版 结合网上教程 服务器实战所得 1.使用DVD做yum源新建dvd挂载目录[root@fxq-dp ~]# mkdir /media/iso进入到DVD挂 ...
- Easyui 异步树的实现
网上最多的onBeforeExpand 可用,因为后台代码没写对导致树形结构重复加载数据 前端代码: <%@ page language="java" contentType ...
- Objective-C( Foundation框架 一 NSFileManager)
NSFileManager 用来管理文件系统的 它可以用于常见的文件,文件夹操作(拷贝,剪切,创建) NSFileManager使用了单例模式(Singleton) 使用defaultManager可 ...
- CentOS5.4 搭建Hadoop2.5.2伪分布式环境
简介: Hadoop是处理大数据的主要工具,其核心部分是HDFS.MapReduce.为了学习的方便,我在虚拟机上搭建了一个伪分布式环境,来进行开发学习. 一.安装前准备: 1)linux服务器:Vm ...
- BZOJ AC800纪念
貌似没什么好纪念的...QAQQQ 好不容易水到了800还是记录一下好了....不过感觉水这么多题没有意义啊[思考熊] 然后就没有然后了恩 不过我到底是为什么才努力的呢...前途一阵迷茫,根本没有什么 ...