Study (25) 썸네일형 리스트형 [Flutter]flutter doctor --android-licenses java 오류 java.lang.NoClassDefFoundError Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema at com.android.repository.api.SchemaModule$SchemaModuleVersion.(SchemaModule.java:156) at com.android.repository.api.SchemaModule.(SchemaModule.java:75) at com.android.sdklib.repository.AndroidSdkHandler.(AndroidSdkHandler.java:81) at com.android.sdklib.tool.sdkmanager.Sd.. 인텔리제이와 Gradle 스프링 설정법 프로젝트 생성 프로젝트 우클릭 Add Framework Support 클릭 스프링 선택 OK build.gradle 파일 수정 // https://mvnrepository.com/artifact/org.springframework/spring-context compile group: 'org.springframework', name: 'spring-context', version: '5.2.3.RELEASE' // https://mvnrepository.com/artifact/org.springframework/spring-test testCompile group: 'org.springframework', name: 'spring-test', version: '5.2.3.RELEASE' // https:.. 백준 자바 알고리즘 [4344 : 평균은 넘겠지] Scanner sc = new Scanner(System.in); int test = sc.nextInt(); //케이스 수 int num = sc.nextInt(); //학생 수 int[] s = new int[num]; double avg = 0; //평균 for (int i = 0; i avg){ avgS++; } } System.out.printf("%.3f",.. 백준 자바 알고리즘 [8958 : OX퀴즈] Scanner sc = new Scanner(System.in); int num = sc.nextInt(); String[] str = new String[num]; for (int i = 0; i < num; i++) { int count = 0, sum = 0; str[i] = sc.next(); for (int j =0; j < str[i].length(); j++) { if (str[i].charAt(j) == 'o') sum += ++count; else count = 0; } System.out.println(sum); } sc.close(); string배열을 이용해서 해결. str[0]에 'oooxxooxx' 이렇게 들어가 있다면 charAt()으로 각 인덱스의 값을 구할 수 있다. 그 인.. 백준 자바 알고리즘 [나머지] Scanner sc = new Scanner(System.in); int[] number = new int[10]; for (int i = 0; i < 9; i++) { number[i] = sc.nextInt(); number[i]%=42; } sc.close(); IntStream stream = Arrays.stream(number); System.out.println(stream.distinct().count()); int배열 생성. for문으로 10개의 임의의 수를 생성해서 배열에 넣고 넣은 배열을 42로 나눠서 다시 배열에 넣어준다. 스트림을 이용해서 distict으로 중복을 제거하고 count로 숫자를 세면됨. 스트림을 이용하여 간단하게 해결할 수 있다. 다른 정답 코드들. https://i.. 백준 자바 알고리즘 [숫자의 개수] Scanner sc = new Scanner(System.in); int A = sc.nextInt(); int B = sc.nextInt(); int C = sc.nextInt(); sc.close(); int[] counts = new int[10]; int number = A * B * C; while (number > 0) { counts[number % 10]++; number /= 10; } for (int i = 0; i < counts.length; ++i) { System.out.println(counts[i]); } counts 배열은 {0,0,0,0...}; 이겠지 while문을 사용해서 abc의 곱이 0보다 클때까지 돌려주고 counts[나머지값]이 6이면 counts[6]이 되니까.. 백준 자바 알고리즘 [최댓값] Scanner sc = new Scanner(System.in); int []a = new int[9]; int cut = 0; int max = 0; for (int i = 0; i < 9; i++) { a[i] = sc.nextInt(); if (max 백준 자바 알고리즘 [최소,최대] Scanner sc = new Scanner(System.in); int k = sc.nextInt(); int[] a = new int[k]; for (int j=0;j a[i]){ min = a[i]; } } System.out.println(min+" "+max); if문으로 최소값이면 min에 넣고 최대값이면 max 넣어 줌 이전 1 2 3 4 다음