배열 5

[프로그래머스] Array 자료구조 복습 및 실습문제(주차 요금 계산) 풀이 - 파이썬

📖 문제 📃 코드 import math # fees = [120, 0, 60, 591] # records = ["16:00 3961 IN","16:00 0202 IN","18:00 3961 OUT","18:00 0202 OUT","23:58 3961 IN"] # result = [0, 591] def solution(fees, records): answer = [] inTime = [0] * 10000 isIn = [0] * 10000 sumT = [0] * 10000 for record in records: a, b, c = record.split() H, M = a.split(":") if c == "IN": # record for initTime -> inTime[3961] = H*60 + M in..

백준[JAVA] 10816.숫자 카드 2 - 자바

📖 문제 📃 코드 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); int N = Integer.parseInt(br.readLine()); i..

백준[JAVA] 10773.제로 - 자바

📖 문제 📃 코드 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { static int arr[]; static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); public static void main(String[] args) throws IOException { int N = Integer.parseInt(br.readLine()); arr = new int[N]; zero(N); int sum = 0; for(int num : arr){ sum += num; } S..

백준[JAVA] 1920.수 찾기 - 자바

📖 문제 📃 코드 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class Main { public static int[] arr; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(br.readLine()); arr = new int[N]..