Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- import java.util.Collections;
- import java.util.Scanner;
- public class p3 {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- Scanner s = new Scanner(System.in);
- int n = s.nextInt();
- int k = s.nextInt();
- ArrayList<Long> arr = new ArrayList<>();
- ArrayList<Long> arr1 = new ArrayList<>();
- for(int i = 0; i < n; i++) {
- long t = s.nextLong();
- arr.add(t);
- arr1.add(t);
- }
- Collections.sort(arr);
- long max = arr.get(arr.size() - 1);
- if(k == 1) {
- System.out.println(arr.get(0));
- }
- else if(k == 2) {
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement