Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions 09월21일/초중급/.project
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,15 @@
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<filteredResources>
<filter>
<id>1667983548442</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
2 changes: 0 additions & 2 deletions 09월21일/초중급/bin/.gitignore

This file was deleted.

18 changes: 18 additions & 0 deletions 11월02일/초중급/2017032_1712.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include <stdio.h>

//input: A(고정비용), B(per 가변비용), C(per 가격), output: 손익분기점(break-even point)

int main(void){
int A, B, C, output;
scanf("%d %d %d", &A, &B, &C);

if(C>B){
output = A/(C-B);
printf("%d\n", output+1);
}
else{
printf("-1\n");
}
return 0;

}
25 changes: 25 additions & 0 deletions 11월02일/초중급/2017032_2477.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import sys

input = sys.stdin.readline

if __name__ == '__main__':
k = int(input())
info = []
width = []
height = []

for _ in range(6):
dir, length = map(int, input().split())
info.append(length)
if dir > 2:
height.append(length)
else:
width.append(length)

big_square = max(width) * max(height)
max_width_index = info.index(max(width))
max_height_index = info.index(max(height))
small_square = abs(info[(max_width_index - 1) % 6] - info[(max_width_index + 1) % 6]) * abs(
info[(max_height_index - 1) % 6] - info[(max_height_index + 1) % 6])
area = big_square - small_square
print(area * k)
31 changes: 31 additions & 0 deletions 11월09일/초중급/2017032_5545.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import sys

input = sys.stdin.readline

def calPizzaCalPerWon(toppings_cal, a_cost, b_cost, c_cal):
cost = a_cost + b_cost * len(toppings_cal)
cal = c_cal + sum(toppings_cal)
return cal / cost


if __name__ == '__main__':
#input
n = int(input())
a_cost, b_cost = map(int, input().split())
c_cal = int(input())
topping_cal = []
for _ in range(n):
topping_cal.append(int(input()))

#값이 크게 나오게 하려면 calorie가 큰 것부터 더해야 하기 떄문에 sort해줌
topping_cal.sort(reverse=True)

max = 0
for i in range(n + 1): #topping 개수가 0 ~ n일 떄의 모든 경우의 수 고려
val = calPizzaCalPerWon(topping_cal, a_cost, b_cost, c_cal)
max = val if val > max else max #기존 max 값보다 클 경우에만 max 값 업데이트해주기
try:
topping_cal.pop() #topping 개수를 1개씩 지우기 (calorie가 가장 작은 거)
except:
continue
print(int(max)) #소수점 버린 형태로 print해주기
23 changes: 23 additions & 0 deletions 11월09일/초중급/2017032_7983.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import sys

input = sys.stdin.readline

if __name__ == '__main__':
n = int(input())
assignment = []

for i in range(n):
di, ti = map(int, input().split())
assignment.append([di, ti])

assignment = sorted(assignment, key=lambda x: x[1]) #과제 마감일 기준으로 sort 해주기

startDay = assignment[0][1] - assignment[0][0] #과제를 시작해야 하는 날짜
temp = assignment[0][1] #과제를 다했을 때 되는 날짜
for i in range(1, n):
temp += assignment[i][0]
if temp > assignment[i][1]: #과제를 완료한 날짜가 마감일보다 늦다면
#시작 날짜를 앞당긴다
startDay -= temp - assignment[i][1]
temp -= temp - assignment[i][1]
print(startDay)
32 changes: 32 additions & 0 deletions 11월16일/초중급/2017032_2246.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import sys

input = sys.stdin.readline

if __name__ == '__main__':
n = int(input())
condos = {}

d_candidates = set() # 1번째 조건에만 부합하는 후보들
c_candidates = set() # 2번쨰 조건에만 부합하는 후보들

for _ in range(n):
d, c = map(int, input().split())
try:
condos[d] = min(condos[d], c) # 2번쨰 조건에 의해 만약 거리가 같은 콘도가 있다면, 가장 숙박비가 싼 콘도만 후보가 될 수 있다.
except KeyError:
condos[d] = c

d_condos = sorted(condos.items(), key=lambda x: x[0]) # 거리 중심으로 정렬한 콘도 배열
c_condos = sorted(condos.items(), key=lambda x: x[1]) # 숙박비 중심으로 정렬한 콘도 배열

minCost, minDistance = 100000, 100000
for condo in d_condos: # 1번째 조건에 부합하는 후보들을 찾는 for문
if condo[1] < minCost:
d_candidates.add(condo)
minCost = min(condo[1], minCost)
for condo in c_condos: # 2번째 조건에 부합하는 후보들을 찾는 for문
if condo[0] < minDistance:
c_candidates.add(condo)
minDistance = min(condo[0], minDistance)

print(len(d_candidates.intersection(c_candidates))) # 1번째 & 2번쨰 조건 부합하는 후보들의 숫자 출력
22 changes: 22 additions & 0 deletions 11월16일/초중급/2017032_4436.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import sys

input = sys.stdin.readline


def cal_k(n):
cnt = 1
nums = set()
all = set([1, 2, 3, 4, 5, 6, 7, 8, 9, 0])
while len(all.difference(nums)):
nums = nums.union(set(map(int, list(str(cnt * n)))))
cnt += 1
return cnt - 1


if __name__ == '__main__':
try:
while True:
n = int(input())
print(cal_k(n))
except:
exit(0)
Empty file added 중간고사/2017032_1038.py
Empty file.
Empty file added 중간고사/2017032_1063.py
Empty file.