[백준 1929] 소수 구하기 JAVA
·
코딩테스트/백준
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int start = 0, end = 0; int cnt = 0; start = sc.nextInt(); end = sc.nextInt(); //소수는 약수를 1과 자기 자신만 가짐 for (int i = start; i
[백준 5522] 카드 게임 JAVA
·
코딩테스트/백준
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] n = new int[5]; int sum = 0; for (int i = 0; i < 5; i++) { n[i] = sc.nextInt(); sum += n[i]; } System.out.println(sum); } } 브론즈5짜리 문제라 그런지 역시 너무 쉽다 ㅎㅎ
[백준 1237] 정ㅋ벅ㅋ JAVA
·
코딩테스트/백준
문제를 둘러보다가 재미있어 보이는 문제를 발견하였다. 난이도도 매길 수 없는 미스테리 문제.... public class Main { public static void main(String[] args) { System.out.println("문제의 정답"); } } 말 그대로 "문제의 정답" 을 출력하면 풀리는 거였다. 😄 이런 문제.. 나쁘지 않구만 ㅋ
[백준 14916] 거스름돈 JAVA
·
코딩테스트/백준
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n;//거스름돈 금액 int x = 0;//동전 개수 n = sc.nextInt(); while(n >= 5) { if(n == 8 || n == 6)//8과 6은 2로 거슬러줘야함 break; n-= 5; x++; } if(n % 2 == 0) { while(n >= 2) { n-=2; x++; } System.out.println(x); } else { System.out.println(-1); } } } 이번 문제는 나름 쉽게 푼 것 같다.
JLPT N4 성적 조회
·
일기
2022년 12월 3일에 본 JLPT 결과가 오늘 나왔다!!! 성적 나오는 데 2달이나 걸려서 목 빠지는 줄 알았다. 😔 90점 넘으면 합격인데 운 좋게 105점으로 합격했다. 😁👍 다음은 N2다....
[백준 1253] 좋다 JAVA
·
코딩테스트/백준
import java.util.Scanner; public class Day8 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = 0, cnt = 0;//N, 좋은 수 개수 N = sc.nextInt(); int[] numArr = new int[N]; for (int i = 0; i < numArr.length; i++) { numArr[i] = sc.nextInt(); } for (int k = 0; k < numArr.length; k++) { for (int i = 0; i < k; i++) {//2개씩 더함, 더할 숫자가 numArr[k]보다 크면 넘어감 for (int j = i+1; j ..
[백준 1940] 주몽 JAVA
·
코딩테스트/백준
import java.util.Scanner; public class Day7 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = 0, M = 0; int time=0; N = sc.nextInt(); M = sc.nextInt(); int[] numArr = new int[N]; for (int i = 0; i < numArr.length; i++) {//숫자 입력받고 numArr[i] = sc.nextInt(); } for (int i = 0; i
[백준 2018] 수들의 합 5 JAVA
·
코딩테스트/백준
import java.util.Scanner; public class Day6 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = 0; int sum = 0; int time = 0; int j = 0; System.out.print("자연수 입력 : "); N = sc.nextInt(); //N이 10이라 하면 10이 될 때까지 1부터 계속 연산, 10이 넘어간다면 2부터 다시 연산 while(j
[백준 10986] 나머지 합 JAVA
·
코딩테스트/백준
import java.util.Scanner; public class Day5 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = 0, M = 0; //수의 개수, 나누어 떨어지는 숫자 int x = 0, y = 0;//쌍 (x, y) int time = 0; System.out.print("숫자 개수, 나누어 떨어지는 숫자 입력 : "); N = sc.nextInt();//5 입력시 M = sc.nextInt(); int[] numArr = new int[N+1];//6개 받을 수 있음 System.out.print("숫자" + N + "개 입력 : "); for (int i = 0; i < num..
[백준 11660] 구간 합 구하기 5 JAVA
·
코딩테스트/백준
내가 짠 코드 import java.util.Scanner; public class Day4 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = 0, m = 0;//n = NxN, m = 입력받는 횟수 int sum = 0; System.out.print("NxN의 N과 입력받을 횟수 입력 : "); n = sc.nextInt(); m = sc.nextInt(); int[][] numArr = new int[n][n]; for (int i = 0; i < n; i++) {//n만큼 입력 받기 for (int j = 0; j < n; j++) { numArr[i][j] = sc.nextInt(); } ..