杭电HOJ 1004 Let the Balloon Rise
来源:互联网 发布:自动聊天软件机器人 编辑:程序博客网 时间:2024/06/14 08:27
import java.util.Scanner;
public class Main{
public static void main(String[]args){
Scanner cin=new Scanner(System.in);
while(cin.hasNext()){
public class Main{
public static void main(String[]args){
Scanner cin=new Scanner(System.in);
while(cin.hasNext()){
int a=cin.nextInt();
if(a==0||a<0||a>1000)break;
//if(a>1000)a=1000;
String[]s=new String[a];
for(int i=0;i<a;i++){
String tem=" ";
tem=cin.next();
if(tem.length()>15){
s[i]=tem.substring(0,15);
}
else //不要忘了加else!!否则提交不通过
s[i]=tem;
}
if(a==0||a<0||a>1000)break;
//if(a>1000)a=1000;
String[]s=new String[a];
for(int i=0;i<a;i++){
String tem=" ";
tem=cin.next();
if(tem.length()>15){
s[i]=tem.substring(0,15);
}
else //不要忘了加else!!否则提交不通过
s[i]=tem;
}
int temp,max;
max=temp=0;
String str=" ";
for(int i=0;i<a;i++){
if(s[i]==" ")continue;
temp=0;
for(int j=i+1;j<a;j++){
if(s[i].equals(s[j])){
temp++;s[j]=" ";}
}
if(temp>max)
{
max=temp;
str=s[i];
}
max=temp=0;
String str=" ";
for(int i=0;i<a;i++){
if(s[i]==" ")continue;
temp=0;
for(int j=i+1;j<a;j++){
if(s[i].equals(s[j])){
temp++;s[j]=" ";}
}
if(temp>max)
{
max=temp;
str=s[i];
}
}//end for
if(str.equals(" "))System.out.println(s[0]);
else//别忘了加else否则提交不通过!!
System.out.println(str);
if(str.equals(" "))System.out.println(s[0]);
else//别忘了加else否则提交不通过!!
System.out.println(str);
}//end while
}
}
}
0 0
- 杭电HOJ 1004 Let the Balloon Rise
- 杭电 1004[Let the Balloon Rise]
- 杭电 1004 Let the Balloon Rise
- 杭电 1004 Let the Balloon Rise
- 杭电 1004 Let the Balloon Rise
- 杭电1004 Let the Balloon Rise
- 杭电-1004 Let the Balloon Rise
- 杭电1004---Let the Balloon Rise
- 杭电1004-Let the Balloon Rise
- 【杭电】 1004 Let the Balloon Rise
- 杭电 1004 Let the Balloon Rise
- 杭电1004 Let the Balloon Rise
- [杭电]Let the Balloon Rise
- 杭电Let the Balloon Rise
- 杭电OJ Let the Balloon Rise
- 杭电problem1004- Let the Balloon Rise
- Let the Balloon Rise(杭电ACM 1004)
- 杭电acm 1004 (Let the Balloon Rise)
- 获取Android状态栏高度、actionbar高度
- 将两张单链表合并并且去除重复元素
- Ubuntu中bash自动补全忽略大小写
- poj2488(DFS)之A Knight's Journey
- 疯狂java 第三版 习题5.1 5.2
- 杭电HOJ 1004 Let the Balloon Rise
- oj-7-E-方程求解
- C病毒
- JavaScript中,对象需不需要加引号?
- 一元多项式
- Java 8 Streams 中的数据库 CRUD 操作
- [leetcode]257. Binary Tree Paths
- 用lfw99.9的提取出来的特征在wuxiang的上面测试出来的结果
- android——彻底关闭——应用程序