목록코딩/백준 알고리즘 (97)
삐까냥의 파도타기
문제 출처 : https://www.acmicpc.net/problem/11726 import java.util.Scanner; public class Main {public static void main(String[] args){Scanner scanner = new Scanner(System.in);int input = scanner.nextInt();calResult(input);} static void calResult(int value) {int temp1 = 1;int temp2 = 2;if ( value == 1 ) {System.out.println(temp1);} else if (value == 2 ) {System.out.println(temp2);} else {for (int i=3..
문제 출처 : https://www.acmicpc.net/problem/1932 import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner scanner = new Scanner(System.in);int input = scanner.nextInt();int[][] array = new int[input][input];int width = 2; //입력 값을 계산하면서 저장하기 array[0][0] = scanner.nextInt();for ( int i = 1; i < input; i++ ) {for (int j = 0; j < width; j++ ) {int temp = scanner.next..
문제 출처 : https://www.acmicpc.net/problem/9095 import java.util.Scanner; public class Main {static int[] arrayValue;public static void main(String[] args) {Scanner scanner = new Scanner(System.in);int input = scanner.nextInt();int[] array = new int[input];int max = 0;//입력한 값을 차례대로 넣는다.for ( int i = 0; i te..
문제 출처 : https://www.acmicpc.net/problem/2579 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in);int input = scanner.nextInt();int[] stair = new int[input];int[] stairSum = new int[input];for ( int i = 0; i 0 ) {stairSum[0] = stair[0];//1번째의 가장 큰 ..
문제 출처 : https://www.acmicpc.net/problem/1149 import java.util.Scanner;public class Main {static int[] array = new int[3]; public static void main(String[] args){ Scanner scanner = new Scanner(System.in);int input = scanner.nextInt(); for (int i = 0; i < input; i++) {setNext(scanner.nextInt(), scanner.nextInt(), scanner.nextInt());} //세가지 값 중에서 가장 작은 값을 선택하기int result = array[0] < array[1] ? arra..
문제 출처 : https://www.acmicpc.net/problem/1463 import java.util.Scanner;public class Main { public static void main(String[] args){Scanner scanner = new Scanner(System.in);int input = scanner.nextInt();findNum(input);} static void findNum(int n) { int[] arrayNum = new int[n+1];//default로 0 세팅for ( int i = 2; i
문제 출처 : https://www.acmicpc.net/problem/1003 import java.util.Scanner;public class Main { static int[][] array = new int[41][2];//0과 1의 호출 횟수를 저장하기 위해 public static void main(String[] args){ //먼저 0과 1의 호출 횟수를 세팅한다.setFibo();Scanner scanner = new Scanner(System.in);int input = scanner.nextInt();for ( int i = 0; i < input; i++ ) {int temp = scanner.nextInt();System.out.println(array[temp][0] + " "..