diff --git "a/HomeWork/2.\354\210\230\355\225\231/10818.py" "b/HomeWork/2.\354\210\230\355\225\231/10818.py" new file mode 100644 index 0000000..e105579 --- /dev/null +++ "b/HomeWork/2.\354\210\230\355\225\231/10818.py" @@ -0,0 +1,4 @@ +N = int(input()) +L = list(map(int, input().split())) +print(min(L), end=" ") +print(max(L)) \ No newline at end of file diff --git "a/HomeWork/2.\354\210\230\355\225\231/10870.py" "b/HomeWork/2.\354\210\230\355\225\231/10870.py" new file mode 100644 index 0000000..333d103 --- /dev/null +++ "b/HomeWork/2.\354\210\230\355\225\231/10870.py" @@ -0,0 +1,8 @@ +L = [0, 1] + +n = int(input()) + +for i in range(2, n+1): + L.append(L[i-2] + L[i-1]) + +print(L[n]) diff --git "a/HomeWork/2.\354\210\230\355\225\231/1292.py" "b/HomeWork/2.\354\210\230\355\225\231/1292.py" new file mode 100644 index 0000000..64445a1 --- /dev/null +++ "b/HomeWork/2.\354\210\230\355\225\231/1292.py" @@ -0,0 +1,7 @@ +L = [] +a, b = map(int, input().split()) +for i in range(1000): + for j in range(i): + L.append(i) + +print(sum(L[a-1:b])) diff --git "a/HomeWork/2.\354\210\230\355\225\231/1978.py" "b/HomeWork/2.\354\210\230\355\225\231/1978.py" new file mode 100644 index 0000000..cdad9f1 --- /dev/null +++ "b/HomeWork/2.\354\210\230\355\225\231/1978.py" @@ -0,0 +1,18 @@ +N= int(input()) +L= list(map(int, input().split())) + +c = 0 + +for n in L: + if n == 1: + continue + if n == 2 or n == 3: + c += 1 + else: + for i in range(2, int(n/2)+1): + if n % i == 0: + break + if i == int(n/2): + c += 1 + +print(c) \ No newline at end of file diff --git "a/HomeWork/2.\354\210\230\355\225\231/2309.py" "b/HomeWork/2.\354\210\230\355\225\231/2309.py" new file mode 100644 index 0000000..c126106 --- /dev/null +++ "b/HomeWork/2.\354\210\230\355\225\231/2309.py" @@ -0,0 +1,21 @@ +L = [] +for i in range(9): + L.append(int(input())) +A = sum(L)-100 + +def DeleteFakeDwarf(L): + for i in range(8): + for j in range(1,9): + if j <= i: + continue + if L[i]+L[j] == A: + one, two = L[i], L[j] + L.remove(one) + L.remove(two) + return + +DeleteFakeDwarf(L) +L.sort() + +for i in L: + print(i) diff --git "a/HomeWork/2.\354\210\230\355\225\231/2460.py" "b/HomeWork/2.\354\210\230\355\225\231/2460.py" new file mode 100644 index 0000000..5c790b6 --- /dev/null +++ "b/HomeWork/2.\354\210\230\355\225\231/2460.py" @@ -0,0 +1,9 @@ +current_passenger = 0 +max_passenger = 0 + +for _ in range(10): + o, i = map(int, input().split()) + current_passenger += (i - o) + if current_passenger > max_passenger: + max_passenger = current_passenger +print(max_passenger) \ No newline at end of file diff --git "a/HomeWork/2.\354\210\230\355\225\231/2501.py" "b/HomeWork/2.\354\210\230\355\225\231/2501.py" new file mode 100644 index 0000000..2884eda --- /dev/null +++ "b/HomeWork/2.\354\210\230\355\225\231/2501.py" @@ -0,0 +1,12 @@ +N, K = map(int, input().split()) + +divisorList = [] + +for i in range(1, N+1): + if N % i == 0: + divisorList.append(i) + if len(divisorList) == K: + print(i) + break +if len(divisorList) < K: + print(0) \ No newline at end of file diff --git "a/HomeWork/2.\354\210\230\355\225\231/2581.py" "b/HomeWork/2.\354\210\230\355\225\231/2581.py" new file mode 100644 index 0000000..c2820fb --- /dev/null +++ "b/HomeWork/2.\354\210\230\355\225\231/2581.py" @@ -0,0 +1,22 @@ +M= int(input()) +N= int(input()) + +L = [] + +for n in range(M, N+1): + if n == 1: + continue + if n == 2 or n == 3: + L.append(n) + else: + for i in range(2, int(n/2)+1): + if n % i == 0: + break + if i == int(n/2): + L.append(n) + +if len(L) == 0: + print(-1) +else: + print(sum(L)) + print(min(L)) \ No newline at end of file diff --git "a/HomeWork/2.\354\210\230\355\225\231/2609.py" "b/HomeWork/2.\354\210\230\355\225\231/2609.py" new file mode 100644 index 0000000..9c8b87d --- /dev/null +++ "b/HomeWork/2.\354\210\230\355\225\231/2609.py" @@ -0,0 +1,17 @@ +# 최대공약수와 최소공배수 +# 유클리드호제법을 활용한 최대공약수 최소공배수 + +# 최대공약수 +def gcd(a, b): + while b>0: + a, b = b, a % b + return a + +# 최소공배수 +def lcm(a,b): + return a*b / gcd(a,b) + +a, b = map(int, input().split()) + +print(gcd(a,b)) +print(int(lcm(a,b))) diff --git "a/HomeWork/2.\354\210\230\355\225\231/2693.py" "b/HomeWork/2.\354\210\230\355\225\231/2693.py" new file mode 100644 index 0000000..6b2bdbe --- /dev/null +++ "b/HomeWork/2.\354\210\230\355\225\231/2693.py" @@ -0,0 +1,7 @@ +#N번째 큰 수 +T = int(input()) + +for _ in range(T): + L = list(map(int, input().split())) + L.sort(reverse=True) + print(L[2]) \ No newline at end of file diff --git "a/HomeWork/2.\354\210\230\355\225\231/3460(\355\213\200\353\246\274).py" "b/HomeWork/2.\354\210\230\355\225\231/3460(\355\213\200\353\246\274).py" new file mode 100644 index 0000000..bef9536 --- /dev/null +++ "b/HomeWork/2.\354\210\230\355\225\231/3460(\355\213\200\353\246\274).py" @@ -0,0 +1,11 @@ +#이진수 + +T = int(input()) +n = int(input()) + +num = str(format(n,'b')) +reversed_num = "".join(reversed(num)) +print(num) +for i in range(len(reversed_num)): + if reversed_num[i] == "1": + print(i, end=" ") \ No newline at end of file