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 ...
随机推荐
- csshover.htc CSS兼容
以下为csshover.htc 内容 <attach event="ondocumentready" handler="parseStylesheets" ...
- less中的减号处理
很奇怪,less中对减号似乎没有特别说明,很容易让人无用. @div1Width:500; @div2Width:200px; .div3cls { width:@div1Width-@div2Wid ...
- 289. Game of Life -- In-place计算游戏的下一个状态
According to the Wikipedia's article: "The Game of Life, also known simply as Life, is a cellul ...
- Python【2】-列表和元组
一.序列 python包含六种内建的序列:列表.元组.字符串.unicode字符串.buffer对象.xrange对象. 列表可以修改,元组是不能修改的. 二.列表 列表list是变长序列,其中的内容 ...
- marquee标签实现页面内容的滚动效果
页面的自动滚动效果,可由javascript来实现, 但是有一个html标签 - <marquee></marquee>可以实现多种滚动效果,无需js控制. 使用marquee ...
- 使用Autolayout对多行文本Label进行布局,高度不准确的解决办法!
BUG描述: 今天公司的项目中发现了一个BUG,大概给大家描述一下,tabbleView有一个tableFooterView,这个footView中有一个Label,是多行显示文本,程序用的是Auto ...
- 动态获取R.drawable.xx资源
String imageName = "index_fragmen"+getColor();final int resId = context.getResources().get ...
- 14071702(SkeletalControl_Limb)
[目标] SkeletalControl_Limb [思路] HumanIK的15 个节点 CCDIK [步骤] 1 先编译[!BuildAll] [注]先把SYSTEM文件夹该为非只读属性,编译生成 ...
- python爬取数据保存入库
import urllib2 import re import MySQLdb class LatestTest: #初始化 def __init__(self): self.url="ht ...
- TFS Workspace 更改电脑名称
不小心改了计算机名称 导致VS在保存项目的时候,包如下错误: 解决方法: 第一步: 第二步:输入如下片段 tf workspaces /updateComputerName:旧计算机名称 /coll ...