본문 바로가기

Beakjoon&프로그래머스/Java375

[프로그래머스/Java] [PCCE 기출문제] 7번 / 버스 -Codeclass Solution { public int solution(int seat, String[][] passengers) { int num_passenger = 0; for(int i=0; i num){ return 0; } else{ return num; } } public int func2(int num){ if(num > 0){ return 0; } else{ return num; } } public int func3(String[] station){ int .. 2025. 2. 22.
[프로그래머스/Java] [PCCE 기출문제] 6번 / 물 부족 -Codeclass Solution { public int solution(int storage, int usage, int[] change) { int total_usage = 0; for(int i=0; i storage){ return i; } } return -1; }} 2025. 2. 22.
[프로그래머스/Java] [PCCE 기출문제] 6번 / 가채점 -Codeclass Solution { public String[] solution(int[] numbers, int[] our_score, int[] score_list) { int num_student = numbers.length; String[] answer = new String[num_student]; for (int i = 0; i 2025. 2. 22.
[프로그래머스/Java] [PCCE 기출문제] 5번 / 심폐소생술 -Codeclass Solution { public int[] solution(String[] cpr) { int[] answer = {0, 0, 0, 0, 0}; String[] basic_order = {"check", "call", "pressure", "respiration", "repeat"}; for(int i=0; i 2025. 2. 22.
[프로그래머스/Java] [PCCE 기출문제] 3번 / 수 나누기 -Codeimport java.util.Scanner;public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int number = sc.nextInt(); int answer = 0; while (number > 0){ answer += number % 100; number /= 100; } System.out.println(answer); }} 2025. 2. 22.
[프로그래머스/Java] [PCCE 기출문제] 1번 / 출력 -Codeimport java.util.Scanner;public class Solution { public static void main(String[] args) { String msg = "Spring is beginning"; int val1 = 3; String val2 = "3"; System.out.println(msg); System.out.println(val1 + 10); System.out.println(val2 + "10"); }} 2025. 2. 22.