设为首页 加入收藏

TOP

hdu 2072 (二)
2014-11-23 20:25:35 来源: 作者: 【 】 浏览:8
Tags:hdu 2072
Map map;
while(true){

str = scanner.nextLine();
str = str.trim().replaceAll("\\s{1,}", " ");

if(str.startsWith("#")){
break;
}
String[] strs = str.split(" ");
map = new HashMap();
for(int i = 0 ; i < strs.length ; ++i){
map.put(strs[i], 0);
}

System.out.println(map.keySet().size());
}



}
}

package com.njupt.acm;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class HDU_2072 {

public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);

String str ;
Map map;
while(true){

str = scanner.nextLine();
str = str.trim().replaceAll("\\s{1,}", " ");

if(str.startsWith("#")){
break;
}
String[] strs = str.split(" ");
map = new HashMap();
for(int i = 0 ; i < strs.length ; ++i){
map.put(strs[i], 0);
}

System.out.println(map.keySet().size());
}



}
}


首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇hdu 4649 Professor Tian 多校联.. 下一篇hdu1166 树状数组

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·MySQL 基础入门视频 (2025-12-26 23:20:22)
·小白入门:MySQL超详 (2025-12-26 23:20:19)
·关于 MySQL 数据库学 (2025-12-26 23:20:16)
·SOLVED: Ubuntu 24.0 (2025-12-26 22:51:53)
·Linux 常用命令最全 (2025-12-26 22:51:50)