본문 바로가기

with my rubber duck/codingTest44

[백준 2798] 블랙잭 풀어보기 쉽군 ㅎ + 복습 https://www.acmicpc.net/problem/2798 2798번: 블랙잭 첫째 줄에 카드의 개수 N(3 ≤ N ≤ 100)과 M(10 ≤ M ≤ 300,000)이 주어진다. 둘째 줄에는 카드에 쓰여 있는 수가 주어지며, 이 값은 100,000을 넘지 않는 양의 정수이다. 합이 M을 넘지 않는 카드 3장 www.acmicpc.net //1. 카드개수(N), 블랙잭 숫자(M) 입력받기 //2. 카드개수만큼 숫자 입력받기 //3. 숫자카드 3개 더한 값 중에 M에 가까운 수 구하기 import java.util.Scanner; class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int N=s.. 2022. 7. 15.
[백준 10870] 피보나치 수 5 풀기 https://www.acmicpc.net/problem/10870 import java.util.Scanner; class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); System.out.println(fibonacci(N)); } static int fibonacci(int N){ if(N==0) return 0; if(N==1) return 1; return fibonacci(N-1) +fibonacci(N-2); } } 걍 외워 띠기럴 2022. 7. 14.
[백준 1978]소수찾기. 소수 몇번짼데 아직도 헤매는지 모르겠네 https://www.acmicpc.net/problem/1978 import java.util.Scanner; class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int N = scanner.nextInt(); int cnt = 0; for (int i = 0; i < N; i++) { int num = scanner.nextInt(); if (num != 1) { for (int j = 2; j 2022. 7. 13.
[백준 1316] 그룹단어 체크 + 복습 !! import java.util.Scanner; class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int cnt=N; for(int i=0;i 2022. 7. 12.
[프로그래머스] 숫자 문자열과 영단어 풀어보기 class Solution { public int solution(String s) { String[] word = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"}; for (int i = 0; i < 10; i++) { s = s.replace(word[i], String.valueOf(i)); } return Integer.parseInt(s); } } 그래 나 혼자푼거 아니다 근데 이렇게 간단한거였다니 2022. 7. 11.
[프로그래머스] 없는숫자 더하기 class Solution { public int solution(int[] numbers) { int answer = 0; int cnt=0; for(int i=0;i 2022. 7. 6.
728x90