Open hwangnk1004 opened 4 years ago
문제 http://59.23.150.58/30stair/pir/pir.php?pname=pir
import java.util.Scanner;
public class Main { public static void main(String args[]) {
Scanner scanner = new Scanner(System.in); int[] arr = new int[20]; int empty = 0; for (int i = 0; i < arr.length; i++) { arr[i] = scanner.nextInt(); } for (int i = 0; i < arr.length - 1; i++) { for (int j = i; j < arr.length; j++) { if (arr[i] >= arr[j]) { empty = arr[i]; arr[i] = arr[j]; arr[j] = empty; } } } System.out.println(arr[arr.length - 1] + arr[arr.length - 2]); System.out.println(arr[arr.length - 1] + " " + arr[arr.length - 2]); }
}
문제 http://59.23.150.58/30stair/pir/pir.php?pname=pir
답
import java.util.Scanner;
public class Main { public static void main(String args[]) {
}