알고리즘 문제풀이/백준(자바)
-
[java]백준 Hook 10189번알고리즘 문제풀이/백준(자바) 2023. 5. 10. 23:43
코드 public class BOJ_10189 { public static void main(String[] args) { System.out.println("# # #### #### # #"); System.out.println("#### # # # # # #"); System.out.println("#### # # # # # #"); System.out.println("# # #### #### # #"); } } 링크 https://www.acmicpc.net/problem/10189 10189번: Hook Print out the word Hook as shown below. www.acmicpc.net
-
[java]백준 세수정렬 2752번알고리즘 문제풀이/백준(자바) 2023. 5. 9. 23:33
코드 import java.util.Arrays; import java.util.Scanner; public class BOJ_2752 { public static void main(String[] args) { Scanner in =new Scanner(System.in); int[] q = new int[3]; for (int i = 0; i < 3; i++) { q[i]=in.nextInt(); } Arrays.sort(q); for (int j = 0; j < 3; j++) { System.out.print(q[j] +" "); } in.close(); } } 링크 https://www.acmicpc.net/problem/2752 2752번: 세수정렬 숫자 세 개가 주어진다. 이 숫자는 1보다 크..
-
[java]백준 Yangjojang of The Year 11557번알고리즘 문제풀이/백준(자바) 2023. 5. 8. 22:42
코드 import java.util.Scanner; public class BOJ_11557 { public static void main(String[] args) { Scanner in =new Scanner(System.in); int t= in.nextInt();//케이스 for (int i = 0; i < t; i++) { int n=in.nextInt();//학교의 숫자 정수 N String[] a=new String[n];//학교이름 int[] b=new int[n];//지난 한 해동안 소비한 술의 양 for (int j = 0; j < n; j++) { a[j]=in.next(); b[j]=in.nextInt(); } int max=0; int s=0; for (int j = 0; j < ..
-
[java]백준 팬들에게 둘러싸인 홍준 14581번알고리즘 문제풀이/백준(자바) 2023. 5. 7. 23:40
코드 import java.util.Scanner; public class BOJ_14581 { public static void main(String[] args) { Scanner in = new Scanner(System.in); String a = in.next(); System.out.println(":fan::fan::fan:"); System.out.println(":fan::" + a + "::fan:"); System.out.println(":fan::fan::fan:"); in.close(); } } 링크 https://www.acmicpc.net/problem/14581 14581번: 팬들에게 둘러싸인 홍준 첫 번째 줄에 홍준의 아이디를 입력받는다. 홍준의 아이디는 길이가 20 이하인..
-
[java]백준 입실 관리 5524번알고리즘 문제풀이/백준(자바) 2023. 5. 5. 23:35
코드 import java.util.Scanner; public class BOJ_5524 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n =in.nextInt(); for (int i = 0; i < n; i++) { String q=in.next(); System.out.println(q.toLowerCase()); } in.close(); } } 링크 https://www.acmicpc.net/problem/5524 5524번: 입실 관리 JOI회사에서는 방에 들어가기 위해 입실 기록을 입력할 때 알파벳으로 이름을 입력한다. 그런데, 컴퓨터에 오류가 나서 대문자 소문자가 섞여버려 입실 기록이 읽..
-
[java]백준 초콜릿 자르기 2163번알고리즘 문제풀이/백준(자바) 2023. 5. 4. 20:45
코드 import java.util.Scanner; public class BOJ_2163 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n =in.nextInt(); int m =in.nextInt(); int s=0; int a=n*m; while (true) { if (a==1) {//총조각 1이면 System.out.println(s); break; }else{//a는 총조각 1아니면 a-1/s+1 a--;//1조각 -1빼고 s++;//1조각 +1카운터 } } in.close(); } } 링크 https://www.acmicpc.net/problem/2163 2163번: 초콜릿 자르기 정화는 N..