We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 58144f6 + 22dee9a commit 47da8e7Copy full SHA for 47da8e7
Hongjoo/lv1/두정수사이의합.py
@@ -0,0 +1,16 @@
1
+def one_to_n(n):
2
+ return n*(n+1) /2
3
+def solution(a, b):
4
+ '''
5
+ 1~ 5 합 = 1+2+3+4+5 = 15 : n(n+1) /2 = 5*6/2 = 15
6
7
+ # big , small
8
+ if a > b :
9
+ n=a ; m=b
10
+ elif a < b :
11
+ n=b ; m =a
12
+ else : # a==b
13
+ return a
14
+ answer = one_to_n(n) - one_to_n(m-1)
15
+
16
+ return answer
Hongjoo/lv2/최소값만들기.py
@@ -0,0 +1,15 @@
+def solution(A,B):
+ # 누적 최소값 방법 : 최소 * 최대
+ 5+ 8+16 = 29
+ 4+ 6 = 10
+ a= sorted(A)
+ b = sorted(B)
+ print(b)
+ answer = 0
+ for i in range(len(a)):
+ answer += a[i] * b[-1+ -1*i]
0 commit comments