링크 - https://www.acmicpc.net/problem/11399
n = int(input())
arr = list(map(int,input().split()))
arr.sort()
for i in range(1,n):
arr[i]+=arr[i-1]
print(sum(arr))
정렬만 하면 되는 문제...
링크 - https://www.acmicpc.net/problem/1931
n = int(input())
arr=[]
for i in range(n):
line = list(map(int,input().split()))
arr.append(line)
arr.sort(key=lambda x:(x[1],x[0]))
end = arr[0][1]
count=1
for i in range(n):
#start>=end
if arr[i][0]>=end:
end = arr[i][1]
count+=1
print(count)
+) sys 라이브러리 쓰세요~..
끝나는 시간을 기준으로 정렬을 하고 다음 강의의 시작시간이 이전 강의의 끝나는 시간보다 크거나 같다면 포함을 count+=1을 하도록 함
링크 - https://www.acmicpc.net/problem/13305
n = int(input())
distance = list(map(int,input().split()))
prices = list(map(int,input().split()))
answer =0
tmp=0
for i in range(n-1):
if prices[tmp]>prices[i+1]:
answer+=prices[tmp]*distance[i]
tmp=i+1#다음 주유소 갈 때 까지만
else:
answer+=prices[tmp]*distance[i]
print(answer)