本帖最後由 李泳霖 於 2022-12-3 10:02 編輯
c575: APCS 2017-0304-4基地台
1060304APCS實作題_4.pdf
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- import java.util.TreeSet;
- public class P4 {
- BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
- String raw[];
- int n,k;
- TreeSet<Integer> p=new TreeSet<Integer>();
- P4() throws IOException{
- raw=br.readLine().split(" ");
- n=Integer.parseInt(raw[0]);
- k=Integer.parseInt(raw[1]);
- raw=br.readLine().split(" ");
- for (int i = 0; i < n; i++)
- p.add(Integer.parseInt(raw[i]));
- System.out.println(p);
- }
- public static void main(String[] args) throws IOException {
- new P4();
- }
- }
複製代碼 |