67,513
社区成员
发帖
与我相关
我的任务
分享
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Scanner;
import java.util.Map.Entry;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
Map<Double, Integer> map = new HashMap<Double, Integer>();
while (scan.hasNext()) {
int i = 0;
int n = scan.nextInt();
while (i < n) {
double number = scan.nextDouble();
if (map.containsKey(number)) {
int value = map.get(number) + 1;
map.put(number, value);
} else {
map.put(number, 0);
}
i++;
}
}
Iterator<Entry<Double, Integer>> it=map.entrySet().iterator();
while(it.hasNext())
{
Entry<Double,Integer> entry=it.next();
if(entry.getValue()==3)
{
System.out.println(entry.getKey());
}
}
}
}
import java.util.Scanner;
/**
* @author zhuangqing
*/
public class Test {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String s = scan.nextLine();
String[] datas = s.split("\\s+");
int i = 0;
while (i < datas.length) {
int len = Integer.parseInt(datas[i++]);
int temp = i;
while (i < len + temp) {
System.out.print(datas[i++] + " ");
}
System.out.println();
}
}
}