목록해답 (90)
삐까냥의 파도타기
문제 출처 : 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 /=..
문제 출처 : 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 ..