-
var๋function-scoped์ด๊ณ ,let,const๋block-scoped์ ๋๋ค. -
function-scoped์block-scoped๊ฐ ๋ฌด์จ๋ง์ด๋?
| L = int(input()) | |
| A = sorted(list(map(int, input().split()))) | |
| B = sorted(list(map(int, input().split())), reverse=True) | |
| B = B[L-len(B):] | |
| S = sum([A[i] * B[i] for i in range(L)]) | |
| print(S) |
| import re | |
| def return_uppercase(str): | |
| return "".join(re.compile('[A-Z]').findall(str)) # isUpper()์ฌ์ฉํ๋ฉด ๋ | |
| print(return_uppercase(input())) |
| <html> | |
| </html> | |
| <script> | |
| let a = { | |
| test1: 1, | |
| test2: 2 | |
| } | |
| localStorage.setItem('test', JSON.stringify(a)) | |
| let temp = JSON.parse(localStorage.getItem('test')) |
| class DFS_MapSearching: | |
| def __init__(self): | |
| self.row, self.col = list(map(int, input("ํ, ์ด:").split())) | |
| self._map = [[0] * self.row for _ in range(self.col)] | |
| self._min = self.row * self.col | |
| print("ํ์ํ ์ง๋:") | |
| for i in range(self.col): | |
| for j in range(self.row): | |
| self._map[i][j] = 1 |
| # ref: https://www.youtube.com/watch?v=eaYX0Ee0Kcg&t=0s&list=PLBZBJbE_rGRVnpitdvpdY9952IsKMDuev&index=5 | |
| # ์ด ๋ชจ๋์ ๊ธฐ๋ฅ | |
| # 1. ์ฃผ์ด์ง ์ขํ ๋ฐฐ์ด์์ 0, 0๊ณผ ๊ฐ์ฅ ๊ฐ๊น์ด ๊ฐ์ ๊ตฌํ๋ค. | |
| # 2. ์ฃผ์ด์ง ์ขํ ๋ฐฐ์ด์์ ์ฃผ์ด์ง ์ขํ์ ๊ฐ์ฅ ๊ฐ๊น์ด ๊ฐ์ ๊ตฌํ๋ค. | |
| # 3. ์ฃผ์ด์ง ์ขํ ๋ฐฐ์ด์์ ์ฃผ์ด์ง ์ขํ์ ๊ฐ์ฅ ๊ฐ๊น์ด ๊ฐ์ ๋ฐฐ์ด์ ๊ตฌํ๋ค. | |
| # functions of this module | |
| # 1. get closest points from 0, 0 in given points array | |
| # 2. get closest points from given value in given points array | |
| # 3. get closest points array from given value in given points array |
์๋ ํ์ธ์. ์ฌ์์ฌ์ ๋ถ์ ๋ง๋ฃจ์ผ๋ง@h13i32maru์ ๋๋ค. ์ต๊ทผ์ Web ํ๋ก ํธ์๋์ ๋ณํ๋ ๋งค์ฐ ๊ฒฉ๋ ฌํด์, ์กฐ๊ธ ๋์ ๋ ์ฌ์ด์ ์ ์ ์๋ก์ด ๊ฒ์ด ๋์ค๊ณ ์๋๋ผ๊ตฌ์. ๊ทธ๋ฐ ๊ฒฉ๋ ฌํ ๋ณํ์ค ํ๋๊ฐ ES6์ด๋ผ๋ ์ฐจ์ธ๋ JavaScript์ ์ฌ์์ ๋๋ค. ์ด ES6๋ ํ์ฌ ์ฌ์ ์ค์ผ๋ก ์งํ์์ ์์๋ Draft Rev31์ด ๊ณต๊ฐ๋์ด์์ต๋๋ค.
JavaScript๋ ECMAScript(ECMA262)๋ผ๋ ์ฌ์์ ๊ธฐ๋ฐ์ผ๋ก ๊ตฌํ๋์ด์์ต๋๋ค. ํ์ฌ ๋ชจ๋ํ Web ๋ธ๋ผ์ฐ์ ๋ ECMAScript 5.1th Edition์ ๊ธฐ๋ฐ์ผ๋ก ํ JavaScript์คํ ์์ง์ ํ์ฌํ๊ณ ์์ต๋๋ค. ๊ทธ๋ฆฌ๊ณ ๋ค์ ๋ฒ์ ์ธ ECMAScript 6th Edition์ด ํ์ฌ ์ฌ์ ์ค์ผ๋ก, ์ฝ์นญ์ผ๋ก ES6์ด๋ผ๋ ๋ช ์นญ์ด ์ฌ์ฉ๋๊ณ ์์ต๋๋ค.
| def solution(arr): | |
| # ์์๋ ์ ์ธ(์์ด๋ ์๊ด์์) | |
| arr = list(filter(lambda item: item > 0, arr)) | |
| # start๋ฅผ 1๋ถํฐ n๊น์ง +1์ฉ ํ๋ฉด์ ๋ฐฐ์ด์ ์์ผ๋ฉด start๋ฐํ | |
| start = 1 | |
| while True: | |
| if start not in arr: | |
| return start | |
| start += 1 |
| https://github.com/minsuk-heo/problemsolving/blob/master/sort/InsertionSort.py |
| ''' | |
| ํธ๋๋ฐฉ๋ฒ | |
| 1)1๋ก ์์ํ๋ค | |
| 2)1์ด ๋ ๋ฒ์ฐ์ ๋ํ๋์ง ์๋๋ค. ์ 1100(x) | |
| 1 | |
| 10 | |
| 100 | |
| 101 | |
| 1000 |