목록코딩/백준 알고리즘 (97)
삐까냥의 파도타기
문제 출처 : https://www.acmicpc.net/problem/9996 import java.util.Scanner; public class Q9996 { static String[] search;static boolean same;public static void main(String[] args) {Scanner sc = new Scanner(System.in);int num = sc.nextInt();search = sc.next().split("\\*");for ( int i = 0; i < num; i++ ) {System.out.println(split(sc.next()));}}public static String split(String input) {if ( search[0].len..
문제 출처 : https://www.acmicpc.net/problem/9933 import java.util.HashSet;import java.util.Scanner; public class Q9933 { public static void main(String[] args) {Scanner sc = new Scanner(System.in);int num = sc.nextInt();HashSet list = new HashSet();for ( int i = 0; i < num; i++ ) {String temp = sc.next();String reverse = new StringBuffer(temp).reverse().toString();if ( list.contains(reverse) || temp..
문제 출처 : https://www.acmicpc.net/problem/9935import java.util.Scanner; public class Q9935 { static char[] chars;static String boom;public static void main(String[] args) {Scanner sc = new Scanner(System.in);String string = sc.nextLine();boom = sc.nextLine();chars = new char[string.length()];char lastChar = boom.charAt(boom.length()-1);int nowPoint = 0;for ( int i = 0; i < string.length(); i++ ) {..
문제 출처 : https://www.acmicpc.net/problem/1764 import java.util.Collections;import java.util.HashSet;import java.util.LinkedList;import java.util.Scanner; public class Q1764 { public static void main(String[] args) {Scanner sc = new Scanner(System.in);int noListen = sc.nextInt();int noSee = sc.nextInt();HashSet noListenList = new HashSet();for ( int i = 0; i < noListen; i++ ) {noListenList.add(sc...
문제 출처 : https://www.acmicpc.net/problem/2941 import java.util.Scanner; public class Q1475 { public static void main(String[] args) {Scanner sc = new Scanner(System.in);String string = sc.nextLine();string = string.replaceAll("dz=", "a");string = string.replaceAll("lj", "a");string = string.replaceAll("nj", "a");string = string.replaceAll("c-", "a");string = string.replaceAll("d-", "a");string = ..
문제 출처 : https://www.acmicpc.net/problem/2743 import java.util.Scanner; public class Q2743 { public static void main(String[] args) {Scanner sc = new Scanner(System.in);System.out.println(sc.next().length());}}
문제 출처 : https://www.acmicpc.net/problem/1032 import java.util.Scanner; public class Q1032 { public static void main(String[] args) {Scanner sc = new Scanner(System.in);int num = sc.nextInt();char[] chars = sc.next().toCharArray();for ( int i = 1; i < num; i++ ) {String temp = sc.next();for ( int j = 0; j < chars.length; j++ ) {if ( chars[j] != temp.charAt(j) ) {chars[j] = '?';}}}System.out.print..
문제 출처 : https://www.acmicpc.net/problem/10808 import java.util.Scanner; public class Q10808 { public static void main(String[] args) {Scanner sc = new Scanner(System.in);String string = sc.nextLine();int[] alphabet = new int[26];for ( int i = 0; i < string.length(); i++ ) {int temp = Integer.valueOf(string.charAt(i)) - 97;alphabet[temp]++;}for ( int i = 0; i < 26; i++ ) {System.out.print(alphabe..
문제 출처 : https://www.acmicpc.net/problem/1100 import java.util.Scanner; public class Q1100 { public static void main(String[] args) {Scanner sc = new Scanner(System.in);int white = 0;for ( int i = 0; i< 8; i++ ) {String temp = sc.nextLine();int j = 0;if ( i % 2 != 0 ) {j = 1;}for ( ; j < 8; j += 2) {if ( temp.charAt(j) == 'F' ) {white += 1;}}}System.out.println(white);}}
문제 출처 : https://www.acmicpc.net/problem/2908 import java.util.Scanner; public class Q2908 { public static void main(String[] args) {Scanner sc = new Scanner(System.in);int first = reverse(sc.nextInt());int second = reverse(sc.nextInt());System.out.println(first > second ? first : second); }public static int reverse(int su) {int reverse = 0;while (su != 0 ) {reverse *= 10;reverse += (su%10);su /=..