일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
- 알고리즘
- 11053
- SpringTokenizer
- Java #백준 #코딩테스트
- 11054
- kakaocloud
- 코딩테스트
- Java #오븐시계 #백준
- node
- Java #코딩테스트
- sequelize
- Spring #Java #Spring Boot
- 9020
- java
- 15552
- Spring
- 파이썬
- 2447
- 24479
- python
- kakaocloudschool
- 백준
- Spring #Java #Spring Boot #@BeforeEach #@AfterEach
- Spring #Spring Boot #Java
- 카카오 클라우드 스쿨
- 1110
- boj
- Spring #Java #Spring Boot #싱글톤
- 카카오클라우드스쿨
- 7568
- Today
- Total
목록코딩테스트 (13)
YoungSoo
30명의 학생이 존재하는데 그 중 28명만 과제를 내고 안 낸 두 명을 찾는 문제였다. 코드 package three; import java.util.Scanner; public class homework { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] a = new int[31]; int[] b = new int[2]; int c = 0; a[0] = 1; for(int i=1; i
코드 package three; import java.util.Scanner; public class cycle { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int result = a; int count = 0; do{ //10의자리 + 1의 자리 int b = (a/10) + (a%10); a = (a%10)*10 + (b%10); count++; } while(result != a); System.out.println(count); } } 이 문제는 어렵게 생각하지 말고 간단하게 do-while문과 연산을 통해 풀 수 있었다. 먼저 10의 자리의 수와 1의 자리의 ..
이번 문제에선 간단하게 A+B가 아니라 빠른 속도로 계산을 해 출력해야한다. 그러기 위해서는 Scanner가 아닌 Buffer를 사용해야한다. 코드 import java.io.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); int a = Integer.parseInt(br.readLine()); for(int i=0; i
/*1(2738). public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int M = sc.nextInt(); int[][] c = new int[N][M]; int[][] d = new int[N][M]; for(int i=0; i

풀이 import java.util.Scanner; public class sugardelivery { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); if(N==4 || N==7){ // 4, 7일땐 무조건 -1 System.out.println(-1); }else if (N%5 == 0) { // 5로 나눈 나머지가 0이라면 N/5 System.out.println(N/5); }else if(N%5 == 1 || N%5 == 3){ // 5로 나눈 나머지가 1과 3이라면 N/5에서 1을 더해준다. System.out.println(N/5 + 1); }else if(N%5 =..

풀이 import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Scanner; public class numbersort2 { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int a = sc.nextInt(); List b = new ArrayList(); StringBuilder c = new StringBuilder(); for(int i=0; i

풀이 import java.util.Scanner; public class primenumber { public static boolean isPrime(int num){ if(num < 2) return false; for(int i=2; i*i

에라토스테네스의 체란 소수를 찾는 방법을 말한다. 에라토스테네스의 체의 원리 1. 2보다 큰 소수를 구하고자 하는 구간의 모든 수를 나열한다. 2. 2는 소수이므로 오른쪽에 2를 쓴다. (빨간색) 3. 자기 자신을 제외한 2의 배수를 모두 지운다. 4. 남아있는 수 가운데 3은 소수이므로 오른쪽에 3을 쓴다. (초록색) 5. 자기 자신을 제외한 3의 배수를 모두 지운다. 6. 남아있는 수 가운데 5는 소수이므로 오른쪽에 5를 쓴다. (파란색) 7. 자기 자신을 제외한 5의 배수를 모두 지운다. 8. 남아있는 수 가운데 7은 소수이므로 오른쪽에 7을 쓴다. (노란색) 9. 자기 자신을 제외한 7의 배수를 모두 지운다. 10. 위의 과정을 반복하면 구하는 구간의 모든 소수가 남는다. 에라토스테네스의 체의 J..