목록전체 글 (164)
영원히 흘러가는 강
10828 스택 첫째 줄에 주어지는 명령의 수 N (1 ≤ N ≤ 10,000)이 주어진다. 둘째 줄부터 N개의 줄에는 명령이 하나씩 주어진다. 주어지는 정수는 1보다 크거나 같고, 100,000보다 작거나 같다. 문제에 나와있지 않은 명령이 주어지는 경우는 없다. import java.util.Scanner; import java.util.Stack; public class main2 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int x=Integer.parseInt(sc.nextLine()); //입력 수 Stack stack = new Stack(); //스택 System.out.println(" ");..
2798 블랙잭 3개 조합으로 입력받은수에 근접 but 입력수 보다 커서는 안됨 import java.util.Scanner; public class main2 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int x=sc.nextInt(); // 입력 개수 int y=sc.nextInt(); // 근처의 수 int sum=0; int max=0; int[] arr=new int[x]; for(int z=0;z
10872 팩토리얼! import java.util.Scanner; class main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int sum=fac(n); System.out.println(sum); } public static int fac(int n) { if(n==1) { return 1; } else return n*fac(n-1); }} 10870 피보나치 수 (n-2)+(n-1)로 이어짐 import java.util.Scanner; class main { public static void main(String[] args) { Scanner sc=new Sc..
실수로 순서대로 못풀은 문제.. 2884번 알람 시계 입력 받은수의 45분전 출력 import java.util.Scanner; public class main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int x=sc.nextInt(); int y=sc.nextInt(); y=y-45; if(y
thewayaboutme.tistory.com/165 스프링부트 책 3단원: spring data JPA 다뤄보기 * 본문은 (2019, 이동욱, 프리렉)을 공부하고 정리한 내용입니다. 코드에서 import 부분은 모두 생략했습니다. - import static ~ : 임포트의 스태틱은 무슨 �� thewayaboutme.tistory.com 근 1주일을 오류 잡는데 시간을 사용했지만 잘 정리된 글이 있어서 오류를 해결했다.... 나름 괜찮은 삽질인듯하다. 어떤게 문제인지를 파악했고 왜 안되는지에 대해 이해 위의 글을 읽고 해결 105p. @PutMapping("/api/v1/posts") //@PutMapping->@PostMapping 으로 변경 @PostMapping("/api/v1/posts") ..
1096. 바둑판에 올려 놓을 흰 돌의 개수(n)가 첫 줄에 입력된다. 둘째 줄 부터 n+1 번째 줄까지 힌 돌을 놓을 좌표(x, y)가 n줄 입력된다. n은 10이하의 자연수이고 x, y 좌표는 1 ~ 19 까지이며, 같은 좌표는 입력되지 않는다. import java.util.Scanner; public class main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int arr[][]=new int[20][20]; int n=sc.nextInt(); for(int i=0;i
1091. 시작 값(a), 곱할 값(m), 더할 값(d), 몇 번째인지를 나타내는 정수(n)가 입력될 때, n번째 수를 출력하는 프로그램을 만들어보자. import java.util.Scanner; public class main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a=sc.nextInt(); int m=sc.nextInt(); int d=sc.nextInt(); int n=sc.nextInt(); for(int i=1;i
1086. 이미지의 가로 해상도 w, 세로 해상도 h, 한 픽셀을 저장하기 위한 비트 b 가 주어질 때, 압축하지 않고 저장하기 위해 필요한 저장 용량을 계산하는 프로그램을 작성해 보자. import java.util.Scanner; public class main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int w=sc.nextInt(); int h=sc.nextInt(); int b=sc.nextInt(); int sum=0; if(w
1081. 1부터 n까지, 1부터 m까지 숫자가 적힌 서로 다른 주사위 2개를 던졌을 때 나올 수 있는 모든 경우를 출력해보자. import java.util.Scanner; public class main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int x=sc.nextInt(); int y=sc.nextInt(); for(int i=1;i