전체 글848 백준 1065 import java.util.Scanner; public class Main1065 { public static void main(String[] args) { Scanner s = new Scanner(System.in); int N = s.nextInt(); System.out.println(hansu(N)); } public static int hansu(int N) { int count = 0; for (int i = 1; i 2021. 7. 9. 백준 4673 public class Main4673 { /* public static int d(int number){ int sum = number; while(number != 0){ sum = sum + (number % 10); // 첫 째 자리수 number = number/10; // 10으로 나누어 첫 째 자리 삭제 } return sum; }*/ public static void main(String[] args) { int result = 0; int[] notSelfNum = new int[10001]; for (int n = 1; n 2021. 7. 9. 백준 15596 import java.util.Scanner; public class Main15596 { public static long sum(int[] a){ long ans = 0; for(int i=0; i 2021. 7. 9. 깊이 우선 탐색 (DFS) 보호되어 있는 글 입니다. 2021. 7. 9. 너비 우선 탐색 (BFS) 보호되어 있는 글 입니다. 2021. 7. 9. 11 컬렉션 프레임웍(4) Comparator와 Comparable 이전 예제에서 Arrays.sort()를 호출만 하면 컴퓨터가 알아서 배열을 정렬하는 것처럼 보이지만, 사실 Character클래스의 Cmpatable의 구현에 의해 정렬되었던 것이다. Comparator와 Comparable은 모두 인터페이스로 컬렉션을 정렬하는데 필요한 메서드를 정의하고 있으며, Comparable을 구현하고 있는 클래스들은 같은 타입의 인스턴스 끼리 서로 비교할 수 있는 클래스들, 주로 Integer와 같은 wrapper클래스와 String, Date, File과 같은 것들이며 기본적으로 오름차순, 즉 작은 갑셍서부터 큰 값의 순으로 정렬되도록 구현되어 있다. 그래서 Comparable을 구현한 클래스는 정렬이 가능하다는 것을 의미한다. Co.. 2021. 7. 8. 이전 1 ··· 117 118 119 120 121 122 123 ··· 142 다음