목록코딩 (163)
삐까냥의 파도타기
문제 출처 : 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..
문제 출처 : https://www.acmicpc.net/problem/1700 import java.util.Scanner; public class Q1700 { static int[][] multiTab;static int[] jobList;public static void main(String[] args) {Scanner sc = new Scanner(System.in);int size = sc.nextInt();//구멍 개수int num = sc.nextInt(); multiTab = new int[size][2];jobList = new int[num];for ( int i = 0; i < num; i++ ) {jobList[i] = sc.nextInt();}int nowPoint = 0;in..
문제 출처 : https://www.acmicpc.net/problem/1049 import java.util.Scanner; public class Q1049 { static int eaNum;public static void main(String[] args) {Scanner sc = new Scanner(System.in);eaNum = sc.nextInt();int shopNum = sc.nextInt();int[] min = new int[2];min[0] = sc.nextInt();min[1] = sc.nextInt();for ( int i = 1; i < shopNum; i++ ) {int setPrice = sc.nextInt();min[0] = min[0] < setPrice ? min[..
문제 출처 : https://www.acmicpc.net/problem/2875 import java.util.Scanner; public class Q2875 {public static void main(String[] args) {Scanner sc = new Scanner(System.in);int[] member = new int[3];//0.여자, 1.남자, 2.인턴for ( int i = 0; i 1 && member[1] > 0 ) {member[0] -= 2;//여자 두명과 남자 한명을 팀으로 바꾼다.member[1] -= 1;team++;}member[2] -= member[0] + member[1];//나머지 인원들을 인턴으로 보낸다.if ( member[2] > 0 ) {//인턴 할당..
문제 출처 : https://www.acmicpc.net/problem/10610 주의할점 : 입력된 숫자를 모두 사용해야 된다는 것. 이것만 주의하면 너무나 쉬운 문제입니다. import java.util.Scanner; public class Q10610 {public static void main(String[] args) {Scanner sc = new Scanner(System.in);String number = sc.next();int[] nums = new int[10];int sum = 0;for ( int i = 0; i < number.length(); i++ ) {int temp = number.charAt(i)-48;nums[temp] += 1;sum += temp;}if ( num..
문제 출처 : https://www.acmicpc.net/problem/2217 import java.util.ArrayList;import java.util.Arrays;import java.util.Collections;import java.util.Scanner; public class Q2217 { public static void main(String[] args) {Scanner sc = new Scanner(System.in);int num = sc.nextInt();int[] lopeList = new int[num];for ( int i = 0; i < num; i++ ) {lopeList[i] = sc.nextInt();}Arrays.sort(lopeList);int result = l..
문제 출처 : https://www.acmicpc.net/problem/11399 import java.util.ArrayList;import java.util.Collections;import java.util.Scanner; public class Main {public static void main(String[] args) {Scanner scanner = new Scanner(System.in);int num = scanner.nextInt();ArrayList number = new ArrayList();for ( int i = 0; i < num; i++ ) {number.add(scanner.nextInt());}Collections.sort(number);int sum = 0;for ( ..