목록코딩/백준 알고리즘 (97)
삐까냥의 파도타기
문제 출처 : https://www.acmicpc.net/problem/1157 import java.util.Scanner; public class Q1157 { public static void main(String[] args) {Scanner sc = new Scanner(System.in);String string = sc.nextLine().toUpperCase();int max = 0;int[] alphabet = new int[26];for ( int i = 0; i < string.length(); i++ ) {int temp = Integer.valueOf(string.charAt(i)) - 65;if ( 0
문제 출처 : https://www.acmicpc.net/problem/10809 import java.util.Scanner; public class Q10809 { 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;if ( alphabet[temp] == 0 ) {alphabet[temp] = i+1;}}for ( int i = 0; i < 26..
문제 출처 : https://www.acmicpc.net/problem/11654 import java.util.Scanner; public class Q11654 { public static void main(String[] args) {Scanner sc = new Scanner(System.in);String temp = sc.next();System.out.println(Integer.valueOf(temp.charAt(0)));}}
문제 출처 : https://www.acmicpc.net/problem/1152 현재 기준으로 정답률이 20.785%왜 그럴까 생각해봤는데, 앞, 뒤에 존재하는 띄어쓰기를 생각해야하고중복을 생각하여 코딩했는데, 중복은 신경 쓰지 않아야 하네요. import java.util.Scanner; public class Q1152 { public static void main(String[] args) {int result = 0;Scanner sc = new Scanner(System.in);String string = sc.nextLine();String[] temp = string.split(" ");for ( int i = 0 ; i < temp.length; i++ ) {if ( !temp[i].equ..
.문제 출처 : https://www.acmicpc.net/problem/14890 기출 문제라네요. import java.util.Scanner; public class Q14890 { static int num, L;static int[][] map;public static void main(String[] args) {Scanner sc = new Scanner(System.in);num = sc.nextInt();map = new int[num][num];L = sc.nextInt();for ( int i = 0 ; i < num; i++ ) {for ( int j = 0; j < num; j++ ) {map[i][j] = sc.nextInt();}}int result = 0;for ( int i..
문제 출처 : https://www.acmicpc.net/problem/14889 기출 문제 입니다. import java.util.ArrayList;import java.util.Collections;import java.util.Scanner; public class Main { static int[][] array;static int min = -1, num;public static void main(String[] args) {Scanner sc = new Scanner(System.in);num = sc.nextInt();array = new int[num][num]; for ( int i = 0; i < num; i++ ) {for ( int j = 0; j < num; j++ ) {array..
문제 출처 : https://www.acmicpc.net/problem/1507 import java.util.Scanner; public class Q1507 { public static void main(String[] args) {Scanner sc = new Scanner(System.in);int num = sc.nextInt();int[][] map = new int[num][num];int[][] newMap = new int[num][num];for ( int i = 0; i < num; i++ ) {for ( int j = 0; j < num; j++) {map[i][j] = newMap[i][j] = sc.nextInt();}} for ( int i = 0; i < num; i++ ) ..
문제 출처 : https://www.acmicpc.net/problem/5567 import java.util.HashSet;import java.util.Scanner; public class Q5567 { public static void main(String[] args) {Scanner sc = new Scanner(System.in);sc.nextInt();int num = sc.nextInt();int[][] relationShip = new int[num][2];HashSet friendList = new HashSet();for ( int i = 0 ; i < num; i++ ) {int temp1 = sc.nextInt();int temp2 = sc.nextInt();if ( temp1 ..
문제 출처 : https://www.acmicpc.net/problem/1068 import java.util.Scanner; public class Q1068 {static int[][] nodes;static Scanner sc;public static void main(String[] args) {sc = new Scanner(System.in);int number = sc.nextInt();nodes = new int[number][2];//0.부모노드 1.자식노드 개수for ( int i = 0; i < number; i++ ) {nodes[i][0] = sc.nextInt();}setNode(number);//자식노드 개수 세기removeNode(sc.nextInt());//노드 지우기Syst..
문제 출처 : https://www.acmicpc.net/problem/4963 import java.util.Scanner; public class Q4963 {static int[][] map;static int maxY, maxX;static Scanner sc;public static void main(String[] args) {sc = new Scanner(System.in);int x = 0;while ( (x = sc.nextInt()) != 0 ) {setMap(x);}}static void setMap(int x) {maxX = x;maxY = sc.nextInt();map = new int[maxY][maxX];for ( int i = 0; i < maxY; i++ ) {for ( i..