HDOJ 1004题 Let the Balloon Rise strcmp()函数
and find the result.
This year, they decide to leave this lovely job to you.
letters.
A test case with N = 0 terminates the input and this test case is not to be processed.
5
green
red
blue
red
red
3
pink
orange
pink
0
red
pink
#include <iostream>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
using namespace std; int main()
{
int n,i,j,s=1,b[1010],f[1010];
char a[1010][20];
while(~scanf("%d",&n)&&n)
{
memset(b,0,sizeof(b));
for(i=0; i<n; i++)
{
scanf("%s",a[i]);
}
for(i=0; i<n; i++)
{
f[i]=1;
for(j=i+1; j<n; j++)
{
if(b[j]==0)
{ if(strcmp(a[i],a[j])==0)//这里我不知道为什么用a[i]==a[j]就不可以,求大神评论解释一下,谢谢了
{
b[j]=1;
f[i]=f[i]+1;
}
}
}
}
int s=0;
for(i=0; i<n; i++)
{
if(f[s]<=f[i])
{
s=i;
}
}
printf("%s\n",a[s]);
}
return 0;
}
HDOJ 1004题 Let the Balloon Rise strcmp()函数的更多相关文章
- hdu 1004 Let the Balloon Rise strcmp、map、trie树
Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Oth ...
- 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【STL<map>】
Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Oth ...
- Let the Balloon Rise HDU 1004
Let the Balloon Rise Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other ...
- 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 ...
- hdoj-1004-Let the Balloon Rise(水题)
Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Oth ...
- hdoj Let the Balloon Rise
/*Let the Balloon Rise Problem Description Contest time again! How excited it is to see balloons ...
- HDUOJ Let the Balloon Rise 1004
/* Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Ja ...
随机推荐
- 幾種方法實現C語言Macro for debug
1. #include <stdio.h> #include <stdlib.h> #define DEBUG 1 #ifdef DEBUG #define DEBUG_PRI ...
- iframe 的基本操作
要在服务器环境下才行 1.iframe 下操作父页面window.parent.document.getElementById //全部支持window.top //最顶层ie 下的iframe的on ...
- WORDPRESS开发(一)自定义页面显示分类目录
第一步:自定义一个页面,如index.php 第二步:打开index.php文件,引用wp-blog-header.php文件 require('wp-blog-header.php'); 第三步使用 ...
- React组件一
<div id='test'></div> <script type='text/babel'> var Zu=React.createClass({ return ...
- php加了命名空间没引入初始化文件:类的命名空间要与文件夹名一致namespace Business\Event;缺少了Event
php加了命名空间没引入初始化文件:类的命名空间要与文件夹名一致namespace Business\Event;缺少了Event
- python分割sql文件
之前用joomla帮一学校做了个网站,然后要部署到他们到服务器上,他们只提供了sftp和phpmyadmin的账号,上传网站文件倒是挺顺利的,但后来用phpmyadmin导入mysql数据就遇到问题了 ...
- C#如何使用ES
Elasticsearch简介 Elasticsearch (ES)是一个基于 Lucene 的开源搜索引擎,它不但稳定.可靠.快速,而且也具有良好的水平扩展能力,是专门为分布式环境设计的. Elas ...
- sql 判断一个表的数据不在另一个表中
SELECT a.* FROM a LEFT JOIN b ON a.key = b.key WHERE (b.key IS NULL) end as flag from a select id fr ...
- 7 -- Spring的基本用法 -- 8...
7.8 深入理解容器中的Bean 7.8.1 抽象Bean与子Bean 把多个<bean.../>配置中相同的信息提取出来,集中成配置模版------这个配置模版并不是真正的Bean,因此 ...
- 什么是马甲APP?怎么用马甲APP导流
一.什么是马甲APP? 马甲APP指的是为了让认识你的人猜不到,在常用的用户名外再注册的其他名字的APP. 二.马甲APP与真实APP的区别是什么?相同的地方是什么? 1.应用名称不一样. 2.关键词 ...