HDU-1004-Let the Balloon Rise
来源:互联网 发布:linux下nslookup 编辑:程序博客网 时间:2024/06/05 11:48
import java.util.HashMap;import java.util.Map;import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner cin=new Scanner (System.in); while(cin.hasNext()){ Map<String,Integer> map=new HashMap<String,Integer>(); String key=""; int n=cin.nextInt(); if(n==0) break; for(int i=0;i<n;i++){ key=cin.next(); if(map.containsKey(key)==false){ map.put(key,new Integer(1)); }else{ map.put(key, new Integer(map.get(key).intValue()+1)); } } int max=0; String maxColor = null; for(String tmp:map.keySet()){ if(map.get(tmp).intValue()>max){ max=map.get(tmp).intValue(); maxColor=tmp; } } System.out.println(maxColor); } }}
阅读全文
0 0
- HDU 1004 Let the Balloon Rise
- HDU 1004 Let the Balloon Rise
- hdu 1004 Let the Balloon Rise
- HDU 1004 Let the Balloon Rise
- HDU--1004 Let the Balloon Rise
- hdu 1004 Let the Balloon Rise
- hdu 1004 Let the Balloon Rise
- HDU 1004 Let the Balloon Rise
- hdu 1004 Let the Balloon Rise
- HDU 1004 Let the Balloon Rise
- HDU 1004 Let the Balloon Rise
- Hdu 1004 - Let the Balloon Rise
- HDU 1004 Let the Balloon Rise
- HDU 1004 Let the Balloon Rise
- HDU--1004--Let the Balloon Rise
- hdu 1004 Let the Balloon Rise
- hdu 1004 Let the Balloon Rise
- HDU 1004 Let the Balloon Rise STL
- homework001
- js控制键盘按键(回车、空格)
- 解决jdbcTemplate和jpa查询TINYINT(1)返回BOOLEAN的问题
- MySQL-索引和优化
- rsync脚本优化,以及遇到的些问题
- HDU-1004-Let the Balloon Rise
- C#多线程学习(四) 多线程的自动管理(线程池)
- 自己用的unity学习笔记(二)——unity进阶
- 整除问题
- Win7 U盘安装Ubuntu16.04 双系统详细教程
- 一条贪吃蛇的自我修养——从手动皮皮蛇到智能皮皮蛇
- JSP基础
- Netty源码分析之Reactor线程模型
- 适用于独立游戏开发的Unity3D 网络游戏架构设计