본문 바로가기
반응형

Java21

Chapter 20. Lists, Stacks, Queues, and Priority Queues[Java basic] 20.A - 2차평면의 점을 정렬하기 Time Limit: 1s Memory Limit: 128MB DESCRIPTION 다음 요구사항을 만족하는 프로그램을 작성하라. ■ Point 클래스는 x좌표와 y좌표를 데이터를 가진다. Point 객체들을 좌표에 따라 오름차순으로 정렬하기 위해 Comparable 인터페이스를 정의하라. Point 개체들에 대해서 먼저 x좌표를 기준으로 정렬하고, 복수의 Point가 동일한 x좌표를 가진다면 y좌표로 정렬하라. ■ y좌표를 먼저 정렬하고, 그 다음 x좌표로 정렬하는 CompareY를 작성하라. (Sort points in a plane) Write a program that meets the following requirements: ■ Define a class .. 2021. 11. 6.
Chapter 19. Generics[Java Basic] 19.A - 중복된 값을 가지지 않는 ArrayList Time Limit: 1s Memory Limit: 128MB DESCRIPTION ArrayList를 입력받아 중복된 값을 가지지 않는 새로운 ArrayList를 return 하는 Method를 작성하시오. (Distinct elements in ArrayList) Write the following method that returns a new ArrayList. The new list contains the non-duplicate elements from the original list. INPUT * Line 1 : 자료형 (String, Integer, Double 중 하나) * Line 2 : 자료의 개수 N (1~1,000 범위의 정수.. 2021. 11. 6.
Chapter 18. Recursion(2)[Java Basic] 18.E - 미로 탈출 Time Limit: 1s Memory Limit: 128MB DESCRIPTION Top-Left 모서리에서 Bottom-Right 모서리까지 장애물을 피해서 이동하는데 필요한 최소 이동횟수를 구하라. 8*8 판 . 길 X 장애물 (Create a maze) Write a program that will find a path in a maze, as shown in Figure 18.13a. The maze is represented by an 8 * 8 board. The path must meet the following conditions: The path is between the upper-left corner cell and the lower-right corner c.. 2021. 11. 6.
Chapter 18. Recursion(1)[Java Basic] 18.A - Factorial Time Limit: 1s Memory Limit: 128MB DESCRIPTION 10.9절에서 소개된 BigInteger 클래스를 이용하면 큰 숫자에 대한 팩토리얼을 구할 수 있다 (이를테면, 100!). 팩토리얼 함수를 재귀호출을 이용해서 구현하시오. (그러나, 단순 재귀 호출로는 fail. 메모화를 활용) Using the BigInteger class introduced in Section 10.9, you can find the factorial for a large number (e.g., 100!). Implement the factorial method using recursion. Write a program that prompts the user to e.. 2021. 11. 6.
Chapter 13. Abstract Classes and Interfaces[Java Basic] 13.A - 비교가능한 GeometricObject Time Limit: 1s Memory Limit: 128MB DESCRIPTION GeometricObject를 비교할 수 있도록 Comparable 인터페이스를 구현하고, 주어진 두 개의 GeometricObject 객체 중 더 큰 객체를 반환하는 정적 메소드 max 를 정의하시오. (Enable GeometricObject comparable) Modify the GeometricObject class to implement the Comparable interface, and define a static max method in the GeometricObject class for finding the larger of two GeometricO.. 2021. 11. 6.
Chapter 12. Exception Handling and Text I/O[Java Basic] 12.A - 숫자 포맷 예외처리 DESCRIPTION 숫자가 아닌 문자가 피연산자로 들어 왔을 때, 그 정보를 제공하는 프로그램을 작성하시오. 올바른 표현 : 숫자 op(+, -, *, /, %) 숫자 INPUT Line 1 : N ( 문장의 개수 N = 1 ~ 1000) Line 2 ~ N+1 : 공백으로 구분된 3개의 단어 (차례대로 숫자, op, 숫자) - 단어의 길이는 2을 넘지 않음 OUTPUT Line 1 ~ N : 올바른 문장이면 계산 결과를 출력 올바르지 않은 문장은 "Wrong Input: 올바르지 않은 문자열" 출력 (cf, 피연산자 두개 모두 올바르지 않을 때, 앞에 꺼 출력) SAMPLE INPUT 3 4 + 5 4 - 5 4x – 5 SAMPLE OUTPUT 4 + 5 = 9 4 .. 2021. 11. 6.
반응형