본문 바로가기

알고리즘 & 자료구조569

백준 1193 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main1193 { public static void main(String[] args) throws IOException { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(bf.readLine()); int cnt = 0; int line = 0; while (cnt < N) { line++; cnt = line * (line + 1) / 2; // n(n+1)/2 수열 } if (lin.. 2021. 7. 19.
백준 2292 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main2292 { public static void main(String[] args) throws IOException { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(bf.readLine()); int cnt = 1; int range = 2; if (N == 1) { System.out.println(1); } else { while (range 2021. 7. 19.
백준 1712 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main1712 { public static void main(String[] args) throws IOException { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); String S = bf.readLine(); StringTokenizer st = new StringTokenizer(S, " "); int A = Integer.parseInt(st.nextToken.. 2021. 7. 19.
백준 1316 import java.util.Scanner; public class Main1316 { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int N = sc.nextInt(); int cnt = 0; for (int i = 0; i < N; i++) { if (check() == true) { cnt++; } } System.out.println(cnt); } public static boolean check() { boolean[] check = new boolean[26]; int prev = 0; String str = sc.next(); for (int i = 0; i < str.length().. 2021. 7. 17.
백준 2941 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main2941 { public static void main(String[] args) throws IOException { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); String s = bf.readLine(); String[] croatia = {"c=", "c-", "dz=", "d-", "lj", "nj", "s=", "z="}; for(int i=0; i 2021. 7. 16.
백준 5622 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main5622 { public static void main(String[] args) throws IOException{ BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); String num = bf.readLine(); int result=0; for(int i=0; i 2021. 7. 16.