๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
  • What would life be If we had no courage to attemp anything?

์ „์ฒด ๊ธ€271

Java - sum method๋ฅผ ์ด์šฉํ•œ ๋ฐฐ์—ด ํ•ฉ๊ณ„ ๊ตฌํ•˜๊ธฐ ํ•ฉ๊ณ„ ๊ตฌํ•˜๊ธฐ for๋ฌธ์„ ์ด์šฉํ•œ ํ•ฉ๊ณ„ ๊ตฌํ•˜๊ธฐ import java.util.Scanner; public class Main { public static void main(String[] args) { int[] arr = new int[4]; Scanner put = new Scanner(System.in); for(int i=0; i 2022. 5. 3.
Java - ์ž…๋ ฅ ๋ฐ›๊ธฐ, ํ•˜๋“œ ์ฝ”๋”ฉํ•˜๊ธฐ ํ•˜๋“œ์ฝ”๋”ฉ ํ•˜๋Š” ๋ฐฉ๋ฒ• ์ •์ˆ˜ํ˜• public class Main { public static void main(String[] args) { //์ •์ˆ˜ํ˜•์ผ ๋•Œ int[] ds = {3,2,6,7,1,8}; System.out.println(ds[a]); } } ๋ฌธ์ž์—ด public class Main { public static void main(String[] args) { //๋ฌธ์ž์—ด์ผ ๋•Œ String[] arr = {"m","i","n"}; } } ์ž…๋ ฅ ๋ฐ›๋Š” ๋ฐฉ๋ฒ• ์ •์ˆ˜ํ˜• import java.util.Scanner; public class Main { public static void main(String[] args) { //1.๋ฐฐ์—ด์ƒ์„ฑ int[] arr = new int[3]; //2.์ž…๋ ฅ๋ฐ›๊ธฐ Scanne.. 2022. 5. 3.
[baekjoon]python #2606 ๋ฐ”์ด๋Ÿฌ์Šค https://www.acmicpc.net/problem/2606 2606๋ฒˆ: ๋ฐ”์ด๋Ÿฌ์Šค ์ฒซ์งธ ์ค„์—๋Š” ์ปดํ“จํ„ฐ์˜ ์ˆ˜๊ฐ€ ์ฃผ์–ด์ง„๋‹ค. ์ปดํ“จํ„ฐ์˜ ์ˆ˜๋Š” 100 ์ดํ•˜์ด๊ณ  ๊ฐ ์ปดํ“จํ„ฐ์—๋Š” 1๋ฒˆ ๋ถ€ํ„ฐ ์ฐจ๋ก€๋Œ€๋กœ ๋ฒˆํ˜ธ๊ฐ€ ๋งค๊ฒจ์ง„๋‹ค. ๋‘˜์งธ ์ค„์—๋Š” ๋„คํŠธ์›Œํฌ ์ƒ์—์„œ ์ง์ ‘ ์—ฐ๊ฒฐ๋˜์–ด ์žˆ๋Š” ์ปดํ“จํ„ฐ ์Œ์˜ ์ˆ˜๊ฐ€ ์ฃผ์–ด www.acmicpc.net #boss์ฐพ๊ธฐ def findboss(group,member): if group[member]!=member: group[member]=findboss(group,group[member]) return group[member] #union ์‹œํ‚ค๊ธฐ def union(group,a,b): fa,fb = findboss(group,a),findboss(group,b) #์ˆซ์ž๊ฐ€ ์ž‘์€๊ฑธ ๊ธฐ์ค€์œผ๋กœ union ์‹œ์ผœ.. 2022. 5. 2.
๐“๐จ๐๐š๐ฒ ๐ˆ ๐‹๐ž๐š๐ซ๐ง 2022.05.02.์›” Today I Learn 220502 ์˜ค๋Š˜์€ ๋น„๋™๊ธฐ์™€ ๋™๊ธฐ์— ๋Œ€ํ•ด ๋ฐฐ์› ๋‹ค. ๋น„๋™๊ธฐ์™€ ๋™๊ธฐ์˜ ๊ฐœ๋…์€ ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค. ๋™๊ธฐ :์ˆœ์ฐจ์ , ์ง๋ ฌ์  Task ์ˆ˜ํ–‰ , ์š”์ฒญ์„ ๋ณด๋‚ธ ํ›„ ์‘๋‹ต์„ ๋ฐ›์•„์•ผ๋งŒ ๋‹ค์Œ ๋™์ž‘์ด ์ด๋ฃจ์–ด์ง (blocking) ๋น„๋™๊ธฐ :๋ณ‘๋ ฌ์  Task ์ˆ˜ํ–‰, ์š”์ฒญ์„ ๋ณด๋‚ธ ํ›„ ์‘๋‹ต์„ ๊ธฐ๋‹ค๋ฆฌ์ง€ ์•Š๊ณ  ๋‹ค์Œ ๋™์ž‘์ด ์ด๋ฃจ์–ด์ง (non-blocking) JavaScript๋Š” single threaded์—ฌ์„œ ์ปดํ“จํ„ฐ๊ฐ€ ์—ฌ๋Ÿฌ๊ฐœ์˜ CPU๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ์–ด๋„ main thread๋ผ ๋ถˆ๋ฆฌ๋Š” ๋‹จ์ผ ์Šค๋ ˆ๋“œ์—์„œ๋งŒ ์ž‘์—…์„ ์ˆ˜ํ–‰ํ•œ๋‹ค. ์ด๋Š” ์ด๋ฒคํŠธ๋ฅผ ์ฒ˜๋ฆฌํ•˜๋Š” Call Stack์ด ํ•˜๋‚˜๋ผ๋Š” ๊ฒƒ์„ ์˜๋ฏธํ•œ๋‹ค. ์ด ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด JavaScript๋Š” ์ฆ‰์‹œ ์ฒ˜๋ฆฌํ•˜์ง€ ๋ชปํ•˜๋Š” ์ด๋ฒคํŠธ๋“ค์„ ๋‹ค๋ฅธ๊ณณ (Web API)์œผ๋กœ ๋ณด๋‚ด์„œ ์ฒ˜๋ฆฌํ•˜๋„๋ก ํ•˜๊ณ , ์ฒ˜๋ฆฌ.. 2022. 5. 2.
๐“๐จ๐๐š๐ฒ ๐ˆ ๐‹๐ž๐š๐ซ๐ง 2022.04.28.๋ชฉ Today I Learn 220428 setAttribute()๋Š” ๊ฑฐ์˜ ์‚ฌ์šฉํ•˜์ง€ ์•Š์Œ setAttribute๋Š” ๋„ˆ๋ฌด ๊ฐ•๋ ฅํ•ด์„œ ๊ฑฐ์˜ ์‚ฌ์šฉํ•˜์ง€ ์•Š์Œ. ์ด๋Š” inline์œผ๋กœ ์Šคํƒ€์ผ์„ ์ ์šฉํ•˜๋Š” ๊ฒƒ์ด๋ผ CSS ํŒŒ์ผ์—์„œ ์ ์šฉํ•œ ์„ค์ •๋ณด๋‹ค ์šฐ์„ ์œผ๋กœ ์ ์šฉ๋ฉ๋‹ˆ๋‹ค. ๋•Œ๋ฌธ์— ์ž˜ ์‚ฌ์šฉํ•˜์ง€ ์•Š๋Š”๋‹ค!! ๋”ฐ๋ผ์„œ, ์ •ํ™•ํžˆ๋Š” setAttribute()์™€ classList๊ฐ€ ๋‹ค๋ฃจ๊ณ  ์žˆ๋Š” ๋Œ€์ƒ์˜ ๋ฒ”์œ„๊ฐ€ ๋‹ค๋ฆ„ #setAttribute()๋Š” HTML ์š”์†Œ์— inline ์Šคํƒ€์ผ๋กœ ์–ด๋– ํ•œ ์†์„ฑ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๊ฒƒ -class ์†์„ฑ -style ์†์„ฑ -href ์†์„ฑ -....๋“ฑ๋“ฑ #classList()๋Š” ์š”์†Œ์˜ ์—ฌ๋Ÿฌ ์†์„ฑ ์ค‘ ํ•˜๋‚˜์ธ ํด๋ž˜์Šค ์†์„ฑ๋งŒ์„ ๋‹ค๋ฃจ๋Š” ๊ฒƒ ์š”์†Œ์— ํด๋ž˜์Šค๋ฅผ ์ถ”๊ฐ€/๋ณ€๊ฒฝ/์ œ๊ฑฐ ํ•˜๋Š”์‹์œผ๋กœ ์š”์†Œ๋ฅผ ๋™์ ์œผ๋กœ ๋‹ค๋ฃจ๊ณ  ์‹ถ๋‹ค๋ฉด, classList๋ฅผ .. 2022. 5. 2.
๐“๐จ๐๐š๐ฒ ๐ˆ ๐‹๐ž๐š๐ซ๐ง 2022.04.27.์ˆ˜ Today I Learn 220427 ์˜ค๋Š˜์€ JavaScript์˜ Dom ์กฐ์ž‘์— ๋Œ€ํ•ด ๋ฐฐ์› ๋‹ค. ์žŠ๊ณ ์žˆ๋˜ html&css ๊ฐœ๋…์„ ๋„์ง‘์–ด์˜ค๋ ค๋‹ˆ ์ข€ ํ—ท๊ฐˆ๋ ธ๋‹ค. ์ด๋ฒˆ์ฃผ ๊ธˆ์š”์ผ์— ๋‹ค์‹œ ํ•œ ๋ฒˆ ์“ฑ ํ›‘์–ด๋ด์•ผ๊ฒ ๋‹ค. ์˜ค๋Š˜ ์›Œํฌ์ƒต ๊ณผ์ œ๋ฅผ ํ•˜๋Š”๋ฐ ์•ฝ๊ฐ„ ๋‚ด์šฉ์ด ์ดํ•ด๊ฐ€ ์•ˆ๋˜์–ด์„œ ๊ณผ์ œ ํ’€์ดํ•˜๋Š”๋ฐ ์–ด๋ ค์›€์ด ์žˆ์—ˆ๋‹ค. ์†์„ฑ๊ฐ’ ์ง€์ •ํ•ด์ฃผ๋Š”๊ฑด ์ž˜ ํ–ˆ๋Š”๋ฐ, tag๋ฅผ ์—ฐ๊ฒฐํ•ด ์ค„ ๋•Œ ์•ฝ๊ฐ„ ํ—ท๊ฐˆ๋ ธ๊ณ  // div#app ์š”์†Œ ์„ ํƒ const divTag = document.querySelector('#app') // h1 ํƒœ๊ทธ๋ฅผ createElement ๋กœ ์ƒ์„ฑ const h1Tag = document.createElement('h1') // ์ƒ์„ฑํ•œ h1ํƒœ๊ทธ์˜ ๋‚ด์šฉ์„ '์˜ค๋Š˜์˜ Todo' ๋กœ ์„ค์ • h1Tag.innerText = '์˜ค๋Š˜์˜ Todo' .. 2022. 5. 2.
JavaScript - this this - "์ž๊ธฐ์ฐธ์กฐ๋ณ€์ˆ˜" ์ •์˜ ๋‚ด๊ฐ€ ์–ด๋–ป๊ฒŒ ๋ถˆ๋ฆฌ๋Š๋ƒ์— ๋”ฐ๋ผ ๋ฐ”์ธ๋”ฉ ๋˜๋Š” ๊ฒƒ. ๋ชฉ์  "๊ฐ์ฒด"์—์„œ "๋‚ด"๊ฐ€ ํ”„๋กœํผํ‹ฐ๋‚˜ ๋ฉ”์„œ๋“œ๋ฅผ ์ฐธ์กฐํ•˜๊ธฐ ์œ„ํ•ด "์–ด๋””์„œ" "์–ด๋–ป๊ฒŒ" ๋ถ€๋ฅด๋Š๋ƒ์— ๋”ฐ๋ผ this๋Š” ๋‹ฌ๋ผ์ง„๋‹ค! ์ผ๋ฐ˜ ํ•จ์ˆ˜๋กœ ํ˜ธ์ถœ ๋˜์—ˆ์„ ๋•Œ -> **์ „์—ญ ๊ฐ์ฒด** ํ•จ์ˆ˜() -> window function test(){ console.log(this) } test() Window {0: global, window: Window, self: Window, document: document, name: '', location: Location, …} ๋ฉ”์„œ๋“œ๋กœ ํ˜ธ์ถœ ๋˜์—ˆ์„ ๋•Œ -> **"๊ทธ" ๋ฉ”์„œ๋“œ๋ฅผ ๋ณด์œ ํ•œ ๊ฐ์ฒด ** ๊ฐ์ฒด.๋ฉ”์„œ๋“œ() ->๊ฐ์ฒด const obj = {} const obj = { test : function.. 2022. 5. 2.
JavaScript - ๊ฐ์ฒด(Objects) ๐Ÿค๊ฐ์ฒด(Objects) - “๋‹ค์–‘ํ•œ ํ˜•ํƒœ์˜ ์ž๋ฃŒํ˜•”์„ ๊ฐ€์ง„ ์ž๋ฃŒ๊ตฌ์กฐ ๊ฐ์ฒด : 'ํ‚ค'์™€ '๊ฐ’'์œผ๋กœ ์ด๋ฃจ์–ด์ง„ 'ํ”„๋กœํผํ‹ฐ'๋“ค์˜ ์ง‘ํ•ฉ! (ํ‚ค์™€ ๊ฐ’์˜ ์ง‘ํ•ฉ) ๊ฐ์ฒด์˜ ๋ชฉ์  : ๋‹ค์–‘ํ•œ "๋ฐ์ดํ„ฐ ํƒ€์ž…"์˜ ์ž๋ฃŒ๋“ค์„ ํ• ๋‹นํ•˜๊ธฐ ์œ„ํ•จ ํ”„๋กœํผํ‹ฐ ํ‚ค : (๋ฌธ์ž์—ด) ํ”„๋กœํผํ‹ฐ ๊ฐ’ : (๋ชจ๋“ ๊ฐ’) ํ”„๋กœํผํ‹ฐ ๊ฐ’์ด ํ•จ์ˆ˜์ธ ๊ฒฝ์šฐ๋ฅผ "๋ฉ”์„œ๋“œ" ๋ฉ”์„œ๋“œ : ๊ฐ์ฒด์•ˆ์˜ ํ•จ์ˆ˜ ๊ฐ์ฒด์•ˆ์— ํ”„๋กœํผํ‹ฐ ๊ฐ’์ด ํ•จ์ˆ˜์ธ : ๋ฉ”์„œ๋“œ ํ•จ์ˆ˜ ์•ˆ์— ๋ฉ”์„œ๋“œ๊ฐ€ ํฌํ•จ!! |๊ฐ์ฒด์˜ ์ •์˜์™€ ํŠน์ง• ๊ฐ์ฒด๋Š” ์†์„ฑ(property)์˜ ์ง‘ํ•ฉ์ด๋ฉฐ, ์ค‘๊ด„ํ˜ธ ๋‚ด๋ถ€์— key์™€ value์˜ ์Œ์œผ๋กœ ํ‘œํ˜„ key๋Š” ๋ฌธ์ž์—ด ํƒ€์ž…*๋งŒ ๊ฐ€๋Šฅ (์ฐธ๊ณ ) key ์ด๋ฆ„์— ๋„์–ด์“ฐ๊ธฐ ๋“ฑ์˜ ๊ตฌ๋ถ„์ž๊ฐ€ ์žˆ์œผ๋ฉด ๋”ฐ์˜ดํ‘œ๋กœ ๋ฌถ์–ด์„œ ํ‘œํ˜„ value๋Š” ๋ชจ๋“  ํƒ€์ž…(ํ•จ์ˆ˜ํฌํ•จ) ๊ฐ€๋Šฅ ๊ฐ์ฒด ์š”์†Œ ์ ‘๊ทผ์€ ์  ๋˜๋Š” ๋Œ€๊ด„ํ˜ธ๋กœ ๊ฐ€๋Šฅ (์ฐธ๊ณ ) ke.. 2022. 4. 27.
JavaScript - ๋ฐฐ์—ด(Arrays) ๐Ÿค๋ฐฐ์—ด(Arrays) JavaScript์—์„œ์˜ ๋ฐฐ์—ด์€ “์ •์‹ ๋ฐฐ์—ด”์ด ์•„๋‹˜! “์œ ์‚ฌ ๋ฐฐ์—ด ๊ฐ์ฒด”์ž„! →๊ฐ์ฒด const a = [] typeof a //'object' ๋ฐฐ์—ด์˜ ์ •์˜์™€ ํŠน์ง• ํ‚ค์™€ ์†์„ฑ๋“ค์„ ๋‹ด๊ณ  ์žˆ๋Š” ์ฐธ์กฐ ํƒ€์ž…์˜ ๊ฐ์ฒด(object) ์ˆœ์„œ๋ฅผ ๋ณด์žฅํ•˜๋Š” ํŠน์ง•์ด ์žˆ์Œ ์ฃผ๋กœ ๋Œ€๊ด„ํ˜ธ๋ฅผ ์ด์šฉํ•˜์—ฌ ์ƒ์„ฑํ•˜๊ณ , 0์„ ํฌํ•จํ•œ ์–‘์˜ ์ •์ˆ˜ ์ธ๋ฑ์Šค๋กœ ํŠน์ • ๊ฐ’์— ์ ‘๊ทผ ๊ฐ€๋Šฅ ๋ฐฐ์—ด์˜ ๊ธธ์ด๋Š” array.length ํ˜•ํƒœ๋กœ ์ ‘๊ทผ ๊ฐ€๋Šฅ (์ฐธ๊ณ ) ๋ฐฐ์—ด์˜ ๋งˆ์ง€๋ง‰ ์›์†Œ๋Š” array.length – 1๋กœ ์ ‘๊ทผ const numbers = [1,2,3,4,5] console.log(numbers[0]) //1 console.log(numbers[-1]) //undefined console.log(numbers.length)//5 cons.. 2022. 4. 27.
[baekjoon]python #2589 ๋ณด๋ฌผ์„ฌ 2589๋ฒˆ: ๋ณด๋ฌผ์„ฌ ๋ณด๋ฌผ์„ฌ ์ง€๋„๋ฅผ ๋ฐœ๊ฒฌํ•œ ํ›„ํฌ ์„ ์žฅ์€ ๋ณด๋ฌผ์„ ์ฐพ์•„๋‚˜์„ฐ๋‹ค. ๋ณด๋ฌผ์„ฌ ์ง€๋„๋Š” ์•„๋ž˜ ๊ทธ๋ฆผ๊ณผ ๊ฐ™์ด ์ง์‚ฌ๊ฐํ˜• ๋ชจ์–‘์ด๋ฉฐ ์—ฌ๋Ÿฌ ์นธ์œผ๋กœ ๋‚˜๋‰˜์–ด์ ธ ์žˆ๋‹ค. ๊ฐ ์นธ์€ ์œก์ง€(L)๋‚˜ ๋ฐ”๋‹ค(W)๋กœ ํ‘œ์‹œ๋˜์–ด ์žˆ๋‹ค. ์ด ์ง€๋„์—์„œ www.acmicpc.net from collections import deque col,row = map(int,input().split()) arr = [list(map(str,input())) for _ in range(col)] Max = 0 def bfs(y,x,move): global Max q = deque() q.append((y,x,move)) visit = [[0] * row for _ in range(col)] visit[y][x] = 1 while q: ny,nx,nmov.. 2022. 4. 26.