1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | import java.util.*; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[][] inputArray = new int[N][2]; for(int i=0; i<N; i++){ inputArray[i][0] = sc.nextInt(); inputArray[i][1] = sc.nextInt(); } sort(inputArray); int maxHeightIndex = 0; int maxHeight = inputArray[0][1]; for(int i=0; i<N; i++){ if(inputArray[i][1] > maxHeight){ maxHeightIndex = i; maxHeight = inputArray[i][1]; } } System.out.println(maxHeightIndex+" "+maxHeight); int currentHeight = inputArray[0][1]; for(int i=0;i<maxHeightIndex;i++){ } } static void sort(int[][] inputArray){ for(int i=0; i<inputArray.length - 1; i++){ for(int j=i; j<inputArray.length - 1; j++){ if(inputArray[j][0] > inputArray[j+1][0]){ int tempLocation = inputArray[j][1]; inputArray[j][1] = inputArray[j+1][1]; inputArray[j+1][1] = tempLocation; int tempHieght = inputArray[j][0]; inputArray[j][0] = inputArray[j+1][0]; inputArray[j+1][0] = tempHieght; } } } } } |
Labels
Programming
(16)
Algorithm
(15)
Java
(15)
ASP .NET
(4)
Enterprise Architecture
(4)
PHP and MySQL
(4)
Software Engineering
(2)
C#
(1)
Data Mining
(1)
Deep Learning
(1)
Java Script
(1)
Python
(1)
Sunday, October 18, 2015
창고다각형
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment