반응형 분류 전체보기27 [백준] N과 M (1) 15649번 - java import java.util.Scanner; public class Main { private static int N; private static int M; private static int[] arr; private static boolean[] visit; private static StringBuilder sb; public static void main(String[] args) { Scanner sc = new Scanner(System.in); N = sc.nextInt(); M = sc.nextInt(); arr = new int[M]; visit = new boolean[N + 1]; sb = new StringBuilder(); dfs(0); System.out.println(sb);.. 2021. 11. 6. (js)마지막 달, 마지막 날 구하기 /** * 입력한 년도가 올해라면 이번달을 반환하고 그렇지 않으면 12를 반환 * @param {number | string} year * @returns {number} month */ function getLastMonth(year) { if(Object.prototype.toString.call(year).slice(8, -1) === 'String') year = Number(year) var today = new Date() if(year === today.getFullYear()) { return today.getMonth() + 1 } return 12 } /** * 해당 월의 마지막 날짜를 반환 * 만약 이번달이면 오늘을 반환 * @param {number | string}} year * .. 2021. 11. 5. (js)만 나이 계산 /** * 만 나이 계산 * @param {number | string} birthYear * @param {number | string} birthMonth * @param {number | string} birthDay * @returns {number} age */ function getAge(birthYear, birthMonth, birthDay) { birthYear = Number(birthYear) birthMonth = Number(birthMonth) birthDay = Number(birthDay) var today = new Date() var curYear = today.getFullYear() var age = curYear - birthYear var curBirthDate =.. 2021. 11. 5. [백준] 히스토그램에서 가장 큰 직사각형 6549번 - java import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line = null; while((line = br.readLine()) != null) { StringTokenizer st = new StringTokenizer(line, " "); int n = Integer.parseInt(st.nextTo.. 2021. 11. 2. [백준] 피보나치 함수 1003번 - java import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.InputStreamReader; import java.io.OutputStreamWriter; public class Main { private static int[][] zo = new int[41][2]; public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.ou.. 2021. 11. 2. [백준] 스도쿠 2580번 - java import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { private static int[][] table = new int[9][9]; private static int[][] nullCell = new int[81][2]; private static int n; public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = null; n .. 2021. 11. 2. 이전 1 2 3 4 5 다음 반응형