본문 바로가기

Etc96

[JAVA] 백준 2577번: 숫자의 개수 import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int sum = sc.nextInt() * sc.nextInt() * sc.nextInt(); int[] arr = new int[10]; while(sum > 0) { arr[sum % 10]++; sum /= 10; } for(int i=0; i < arr.length; i++) System.out.println(arr[i]); } } 2021. 12. 18.
동적 계획법(DP, Dynamic Programming) 💟 정의 메모리를 적절히 사용하여 수행 시간 효율성을 비약적으로 향상시킨다. 이미 계산된 결과(작은 문제)는 별도의 메모리 영역에 저장하여 다시 계산하지 않는다. 다이나믹 프로그래밍의 구현은 일반적으로 두 가지 방식(탑다운과 보텀업)으로 구성된다. 💟 조건 최적 부분 구조(Optimal Substructure) - 큰 문제를 작은 문제로 나눌 수 있으며, 작은 문제의 답을 모아서 큰 문제를 해결할 수 있다. 중복되는 부분 문제(Overlapping Subproblem) - 동일한 작은 문제를 반복적으로 해결해야 한다. 💟 피보나치 수열 제2항까지는 1, 제3항부터는 바로 앞의 두 항을 더한 수로 정의된다. 제0항은 생략하기도 한다. 단순 재귀 함수로 피보나치 수열을 구현하면 지수 시간 복잡도를 가진다. .. 2021. 11. 12.
[JAVA] 백준 10951번: A+B - 4 / hasNextInt() / 입력이 있을 때만 반복 while문에 조건을 true로 놓을 시 런타임 에러 발생, 입력이 있을 때만 반복이 되도록 조건을 준다. hasNextInt() import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(sc.hasNextInt()) { int a = sc.nextInt(); int b = sc.nextInt(); System.out.println(a+b); } } } 2021. 8. 1.
[JAVA] 백준 15552번: 빠른 A+B / BufferedReader vs. Scanner 많은 양의 데이터를 입력받을 경우 Scanner를 사용하는 것보다 BufferedReader를 사용하는 것이 훨씬 빠르다. Scanner는 여러 자료형으로 입력값을 받을 수 있고, BufferedReader는 무조건 문자(String)로 처리한다. BufferedReader / BufferedWriter 는 java.io 패키지에 들어있다. 예외 처리(thorws IOException)를 해 준다. (Scanner는 자체 예외 처리) StringTokenizer 와 nextToken()을 이용하여 문자열을 나누고 나눈 문자를 순서대로 출력한다. flush()를 이용하여 buffer를 비워 준다. BufferedReader Scanner: 키보드에 입력하는 것을 바로바로 프로그램에 전달 BufferedRe.. 2021. 8. 1.
웹호스팅(github pages) github(https://github.com)의 pages 기능 https://yujung-jang.github.io/web1/ Spring Dream Hope Finally achieve the goal Great minds have purposes, others have wishes. yujung-jang.github.io 2021. 3. 14.
웹사이트 완성 https://yujung-jang.github.io/web1/ index.html Goal Dream Hope Finally achieve the goal Great minds have purposes, others have wishes. 1.html Goal Dream Hope Dream It's your eyes that shake. The hand that pulls the bowstring. I doubt whether I can hit the mark. The target is always there. 2.html Goal Dream Hope Hope 세종께서 말씀하시길, "그대의 자질은 아름답다 그런 자질을 가지고 아무것도 않겠다 해도 내 뭐라 할 수 없지만 그대가 만약 온 마음과 힘을 다해.. 2021. 3. 14.