-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkyungbin_2_14_python_.py
More file actions
96 lines (68 loc) · 1.98 KB
/
kyungbin_2_14_python_.py
File metadata and controls
96 lines (68 loc) · 1.98 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# -*- coding: utf-8 -*-
"""kyungbin_2.14 python .ipynb
Automatically generated by Colab.
Original file is located at
https://colab.research.google.com/drive/1tqc-h8PA0fgWxRo--4EvR-MjO-i8jPQS
"""
# 피로도
A, B, C, M = map(int, input().split())
fatigue = 0
work = 0
for _ in range(24):
if fatigue + A <= M:
work += B
fatigue += A
else:
fatigue -= C
if fatigue <0:
fatigue =0
print(work)
# 안테나
# 가운데 쪽만 보는 게 어떨까?
import sys
N = int(sys.stdin.readline())
house = list(map(int, sys.stdin.readline().split()))
house.sort()
print(house[(N - 1) // 2])
# ATM
# 크기 순으로 정렬한 후, 누적으로 더함
N = int(input())
people = list(map(int, input(). split()))
people.sort()
full_time = []
result = 0
for i in people:
result += i
full_time.append(result)
print(sum(full_time))
# 회의실 배정
# 1. 회의 시간 별로 정렬해보자
# 2. 회의가 빨리 끝내고 회의 간 간격이 짧을 수록 좋음.
# 3. 회의 시작시간보다 회의 끝나는 시간을 기준으로 정렬해보자 (람다 사용)
N = int(input())
meeting = []
for _ in range(N):
start, finish = (map(int, input().split()))
meeting.append([start,finish])
meeting.sort(key = lambda x : (x[1], x[0]))
#[[1, 4], [3, 5], [0, 6], [5, 7], [3, 8],
#[5, 9], [6, 10], [8, 11], [8, 12], [2, 13], [12, 14]] 예제가 이런 순서로 출력
ending_time = 0
final_meeting = []
for start_time, finish_time in meeting:
if start_time >= ending_time:
ending_time = finish_time
final_meeting.append([start_time, finish_time])
print(len(final_meeting))
#주유소
#아이디어: 다음이 더 싸면 다음만큼만 채운다. 내 다음이 더 비싸면 싼 주유소 나올만큼 주유한다.
N = int(input())
distance = list(map(int, input().split()))
fuel = list(map(int, input().split()))
cost = 0
lowest_price = fuel[0]
for i in range(0, N-1):
if fuel[i] < lowest_price:
lowest_price = fuel[i]
cost += lowest_price * distance[i]
print(cost)