diff --git "a/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2244\354\243\274\354\260\250/1107-3.py" "b/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2244\354\243\274\354\260\250/1107-3.py" index e69de29..67ed74d 100644 --- "a/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2244\354\243\274\354\260\250/1107-3.py" +++ "b/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2244\354\243\274\354\260\250/1107-3.py" @@ -0,0 +1,15 @@ +n=int(input()) +m=int(input()) +if m == 0: + blocks=[] +else: + blocks = list(map(int, input().split())) +mimimum = abs(100-n) +for i in range(99999): + num = str(i) + for j in num: + if int(j) in blocks: #포함되어 있으면 + break + else: + minimum = min(mimimum, abs(n-i)+len(num)) +print(minimum) \ No newline at end of file diff --git "a/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2244\354\243\274\354\260\250/1389-1.py" "b/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2244\354\243\274\354\260\250/1389-1.py" index e69de29..3836713 100644 --- "a/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2244\354\243\274\354\260\250/1389-1.py" +++ "b/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2244\354\243\274\354\260\250/1389-1.py" @@ -0,0 +1,5 @@ +import sys + + +for i in range(N): + result \ No newline at end of file diff --git "a/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2245\354\243\274\354\260\250/1463.py" "b/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2245\354\243\274\354\260\250/1463.py" new file mode 100644 index 0000000..fdc2da7 --- /dev/null +++ "b/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2245\354\243\274\354\260\250/1463.py" @@ -0,0 +1,9 @@ +n = int(input()) +d = [0]*(10**6+1) +for i in range(2, n+1): + d[i] = d[i-1]+1 + if i%3 == 0: + d[i] = min(d[i], d[i//3]+1) + if i%2 == 0: + d[i] = min(d[i], d[i//2]+1) +print(d[n]) \ No newline at end of file diff --git "a/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2245\354\243\274\354\260\250/1541-1.py" "b/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2245\354\243\274\354\260\250/1541-1.py" new file mode 100644 index 0000000..8e510ff --- /dev/null +++ "b/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2245\354\243\274\354\260\250/1541-1.py" @@ -0,0 +1,12 @@ +exp = input().split("-") +num =[] +for i in exp: + sum = 0 + tmp = i.split("+") + for j in tmp: + sum+=int(j) + num.append(sum) +n = num[0] +for i in range(1, len(num)): + n-=num[i] +print(n) \ No newline at end of file diff --git "a/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2245\354\243\274\354\260\250/1541-2.py" "b/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2245\354\243\274\354\260\250/1541-2.py" new file mode 100644 index 0000000..e670c34 --- /dev/null +++ "b/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2245\354\243\274\354\260\250/1541-2.py" @@ -0,0 +1,12 @@ +import sys +input = sys.stdin.readline + +equa = list(map(str, input().split("-"))) +total = 0 +for i, val in enumerate(equa): + temp_list = list(map(int, val.split("+"))) + if i == 0: + total += sum(temp_list) + continue + total -=sum(temp_list) +print(total) \ No newline at end of file diff --git "a/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2245\354\243\274\354\260\250/1541-3.py" "b/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2245\354\243\274\354\260\250/1541-3.py" new file mode 100644 index 0000000..ecc3429 --- /dev/null +++ "b/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2245\354\243\274\354\260\250/1541-3.py" @@ -0,0 +1,11 @@ +import sys +input = sys.stdin.readline +equa = list(map(str, input().split("-"))) +total = 0 +for i, val in enumerate(equa): + temp_list = list(map(int, val.split("+"))) + if i == 0: + total+=sum(temp_list) + continue + total -=sum(temp_list) +print(total) \ No newline at end of file diff --git "a/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2245\354\243\274\354\260\250/1541-4.py" "b/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2245\354\243\274\354\260\250/1541-4.py" new file mode 100644 index 0000000..ecc3429 --- /dev/null +++ "b/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2245\354\243\274\354\260\250/1541-4.py" @@ -0,0 +1,11 @@ +import sys +input = sys.stdin.readline +equa = list(map(str, input().split("-"))) +total = 0 +for i, val in enumerate(equa): + temp_list = list(map(int, val.split("+"))) + if i == 0: + total+=sum(temp_list) + continue + total -=sum(temp_list) +print(total) \ No newline at end of file diff --git "a/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2245\354\243\274\354\260\250/1541-5.py" "b/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2245\354\243\274\354\260\250/1541-5.py" new file mode 100644 index 0000000..0de9f5c --- /dev/null +++ "b/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2245\354\243\274\354\260\250/1541-5.py" @@ -0,0 +1,13 @@ +import sys +input = sys.stdin.readline + +equa = list(map(str, input().split("-"))) +total = 0 +for i, val in enumerate(equa): + temp_list = list(map(int, val.split("+"))) + if i == 0: + total+=sum(temp_list) + continue + else: + total-=sum(temp_list) +print(total) diff --git "a/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2245\354\243\274\354\260\250/1541.py" "b/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2245\354\243\274\354\260\250/1541.py" new file mode 100644 index 0000000..f48d93d --- /dev/null +++ "b/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2245\354\243\274\354\260\250/1541.py" @@ -0,0 +1,14 @@ +nums = input() +current_number = "" +result = 0 +sign = 1 +for i in nums: + if i.isdigit(): + current_number+=i + else: + result+= sign * int(current_number) + if i == "-": + sign = -1 + current_number = "" +result+= sign * int(current_number) +print(result) diff --git "a/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2245\354\243\274\354\260\250/1620-1.py" "b/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2245\354\243\274\354\260\250/1620-1.py" new file mode 100644 index 0000000..2cb2b5d --- /dev/null +++ "b/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2245\354\243\274\354\260\250/1620-1.py" @@ -0,0 +1,19 @@ +def main(): + n, m = map(int, input().split()) + name_to_number = {} + number_to_name = {} + + for i in range(1, n + 1): + name = input() + name_to_number[name] = i + number_to_name[i] = name + + for _ in range(m): + query = input() + if query.isdigit(): + print(number_to_name[int(query)]) + else: + print(name_to_number[query]) + +if __name__ == "__main__": + main() diff --git "a/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2245\354\243\274\354\260\250/1620.py" "b/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2245\354\243\274\354\260\250/1620.py" new file mode 100644 index 0000000..0dbd644 --- /dev/null +++ "b/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2245\354\243\274\354\260\250/1620.py" @@ -0,0 +1,15 @@ +import sys +input = sys.stdin.readline +n,m = map(int, input().split()) +dict = {} + +for i in range(1,n+1): + a = input().rstrip() + dict[i] = a + dict[a] = i +for i in range(m): + query = input().rstrip() + if query.isdigit(): + print(dict[int(query)]) + else: + print(dict[query]) diff --git "a/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2245\354\243\274\354\260\250/1697-1.py" "b/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2245\354\243\274\354\260\250/1697-1.py" new file mode 100644 index 0000000..840a9be --- /dev/null +++ "b/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2245\354\243\274\354\260\250/1697-1.py" @@ -0,0 +1,21 @@ +from collections import deque +def bfs(): + q = deque() + q.append(n) + while q: + x = q.popleft() + if x == k: + print(dist[x]) + break + for nx in (x-1, x+1, x*2): + if 0<=nx<=MAX and not dist[nx]: + dist[nx] = dist[x]+1 + q.append(nx) + + + +MAX = int(10**5) +dist = [0]*(MAX+1) +n,k = map(int, input().split()) + +bfs() \ No newline at end of file diff --git "a/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2245\354\243\274\354\260\250/1697-2.py" "b/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2245\354\243\274\354\260\250/1697-2.py" new file mode 100644 index 0000000..7367c2f --- /dev/null +++ "b/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2245\354\243\274\354\260\250/1697-2.py" @@ -0,0 +1,18 @@ +from collections import deque +def bfs(): + q=deque() + q.append(n) + while q: + x = q.popleft() + if x == k: + print(dist[x]) + break + for nx in (x-1, x+1, x*2): + if 0<=nx<=MAX and not dist[nx]: + dist[nx] = dist[x]+1 + q.append(nx) + +MAX = 10**5 +dist = [0]*(MAX+1) +n,k = map(int, input().split()) +bfs() \ No newline at end of file diff --git "a/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2245\354\243\274\354\260\250/1697.py" "b/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2245\354\243\274\354\260\250/1697.py" new file mode 100644 index 0000000..b51e52a --- /dev/null +++ "b/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2245\354\243\274\354\260\250/1697.py" @@ -0,0 +1,18 @@ +from collections import deque +def bfs(): + q=deque() + q.append(n) + while q: + x=q.popleft() + if x == k: + print(dist[x]) + break + for nx in (x-1, x+1, x*2): + if 0<=nx<=MAX and not dist[nx]: + dist[nx] = dist[x]+1 + q.append(nx) +MAX = 10**5 +dist = [0]*(MAX+1) +n,k = map(int, input().split()) + +bfs() \ No newline at end of file diff --git "a/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2245\354\243\274\354\260\250/1764.py" "b/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2245\354\243\274\354\260\250/1764.py" new file mode 100644 index 0000000..8da225a --- /dev/null +++ "b/\354\230\210\354\233\220/24\353\205\204\353\217\204/3\354\233\2245\354\243\274\354\260\250/1764.py" @@ -0,0 +1,11 @@ +n,m = map(int, input().split()) +unheard = set() +unseen = set() +for _ in range(n): + unheard.add(input()) +for _ in range(m): + unseen.add(input()) +intersection = sorted(list(unheard & unseen)) +print(len(intersection)) +for i in intersection: + print(i) \ No newline at end of file