wc,这个题目有毒
附上我的正确的代码,
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);TreeSet ts = new TreeSet<>();
while (sc.hasNextInt()) {
if(ts.size()>0)
ts.clear();
int length = sc.nextInt();
for(int i=0;i ts.add(sc.nextInt());
Iterator it = ts.iterator();
while(it.hasNext()){
System.out.println(it.next());
}
}
}
}
和按照样例来的代码,按理说下面这个事对的啥,但是就是不对,。。。
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);TreeSet ts = new TreeSet<>();
while (sc.hasNextInt()) {int length = sc.nextInt();
for(int i=0;i ts.add(sc.nextInt());
}Iterator it = ts.iterator(); while(it.hasNext()){
System.out.println(it.next());
}
}
}
附上我的正确的代码,
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);TreeSet
while (sc.hasNextInt()) {
if(ts.size()>0)
ts.clear();
int length = sc.nextInt();
for(int i=0;i
Iterator it = ts.iterator();
while(it.hasNext()){
System.out.println(it.next());
}
}
}
}
和按照样例来的代码,按理说下面这个事对的啥,但是就是不对,。。。
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);TreeSet
while (sc.hasNextInt()) {int length = sc.nextInt();
for(int i=0;i
}Iterator it = ts.iterator(); while(it.hasNext()){
System.out.println(it.next());
}
}
}
大佬看看华为研发工程师编程题里的这道题,太难了!
https://gw-c.nowcoder.com/api/sparta/jump/link?link=https%3A%2F%2Fwww.nowcoder.com%2FquestionTerminal%2F3245215fffb84b7b81285493eae92ff0
全部评论
相关推荐
11-20 18:35
湘潭大学 人力资源VP/CHO 点赞 评论 收藏
分享