![article thumbnail](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fb1m3TV%2Fbtq9NW9uMRp%2FKp29g6oz7kwvljmFfzF0K0%2Fimg.png)
https://www.acmicpc.net/problem/4153 4153번: 직각삼각형 입력은 여러개의 테스트케이스로 주어지며 마지막줄에는 0 0 0이 입력된다. 각 테스트케이스는 모두 30,000보다 작은 양의 정수로 주어지며, 각 입력은 변의 길이를 의미한다. www.acmicpc.net 코드 import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int[] n = new int[3]; while (true) { for (int i = 0; i < 3; i++) n[i] = scan..
![article thumbnail](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FdmoTl6%2Fbtq9PTSjAaM%2F31khA5viDUgMY0m6B6ZeWk%2Fimg.png)
객체 (2) 생성자와 소멸자 그리고 this 키워드 - 디폴트 생성자 객체가 생성될 때 가장 먼저 호출되는 생성자 개발자가 명시하지 않아도 컴파일 시점에 자동 생성됨. - 사용자 정의 생성자 디폴트 생성자 외에 특정 목적에 의해 개발자가 만든 생성자 매개변수에 차이가 있음. - 소멸자 객체가 GC에 의해 메모리에서 제거될 때 finalize() 메서드가 호출됨. (명시x) System.gc();를 사용한다고 해서 GC가 바로 작동하는 것이 아니라, 가급적 빨리 작동하도록 요청. java는 기본적으로 메모리를 개발자가 직접 관리하지 않으므로 일반적으로 System.gc();를 사용하는 경우는 드묾. - this 키워드 현재 객체를 가리키는 객체가 어떤 객체인지 명시하고 싶을 때 사용함. 패키지와 stati..
![article thumbnail](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F76ZGx%2Fbtq9E4UUmmJ%2FeWyE1oI0FULH8Sk9yqyOp1%2Fimg.png)
https://www.hackerrank.com/challenges/insert-a-node-at-the-tail-of-a-linked-list/problem Insert a Node at the Tail of a Linked List | HackerRank Create and insert a new node at the tail of a linked list. www.hackerrank.com Data Structures > Linked Lists 단방향 연결 리스트의 맨 마지막에 노드를 삽입한다. 코드 SinglyLinkedListNode* insertNodeAtTail(SinglyLinkedListNode* head, int data) { SinglyLinkedListNode *new_node , ..
![article thumbnail](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F4IDsH%2Fbtq9IEVn9Xi%2FkKK8otKxntbvyFfrectrV1%2Fimg.png)
https://www.hackerrank.com/challenges/grading/problem Grading Students | HackerRank Round student grades according to Sam's rules. www.hackerrank.com Algorithms > Implementation 점수 배열이 주어지면 기준에 따라 점수를 수정하고, 수정된 점수 배열을 리턴하는 문제이다. 점수를 수정하는 기준은 다음과 같다. 1) 점수가 38 미만인 경우 - 그대로 2) 점수보다 높은 5의 배수 중 가장 작은 수와 점수의 차가 3 이상인 경우 - 그대로 3) 점수보다 높은 5의 배수 중 가장 작은 수와 점수의 차가 3 미만인 경우 - 점수보다 높은 5의 배수 중 가장 작은 수로 수정 코..