๐งฉps10 [๋ฐฑ์ค 1874๋ฒ] ์คํ ์์ด ๐๋ฌธ์ : ๐ํ์ด:์คํ์ ํน์ง์ธ ๋ง์ง๋ง์ผ๋ก ์ ๋ ฅ๋ ์ซ์๊ฐ pop()์์ ์ถ๋ ฅ๋๋ค๋ ๊ฐ๋ ์ ๋์น๊ณ ์์ด์ ์๊ฐ์ด ์ค๋ ๊ฑธ๋ ธ๋ค.์ด ํน์ง๋ง ํ์ฉํ๋ฉด ์๋นํ ์ฌ์์ง๋ ๋ฌธ์ ๋ค. โ๏ธ์ฝ๋:'''https://www.acmicpc.net/problem/1874๋ฌธ์ : ์คํ ์์ด๋์ด๋: ์ค๋ฒ2'''import sysdef ๋ฐฑ์ค1874(): n = int(input()) # ์ ๋ ฅ ๋ฐ์ ์ซ์์ ๊ฐ์ sequence = [int(sys.stdin.readline()) for _ in range(n)] # ์ ๋ ฅ ์์ด stack = [] # ์คํ answer = [] # ์ถ๋ ฅํ ๊ฒฐ๊ณผ ๋ฆฌ์คํธ current = 1 # ์คํ์ ๋ฃ์ ์ซ์ possible = True # ์์ด์ ๋ง๋ค.. 2024. 9. 27. [๋ฐฑ์ค 1966๋ฒ] ํ๋ฆฐํฐ ํ ๐๋ฌธ์ : ๐ํ์ด:pop() ํจ์๋ฅผ ์ฌ์ฉํ๊ฒ ๋๋ฉด ์๊ฐ๋ณต์ก๋๊ฐ ์์ฒญ ๋์์ง ๊ฒ ๊ฐ์,๋ณ์์ ํ์ฌ ์์น๋ฅผ ์ ์ฅํ๊ณ ์ํํ์ฒ๋ผ ๊ฐ๋ฆฌํค๋ ์์น๋ฅผ ์์ง์ด๋ฉด์ ํ์๋ค. ๋ํ pop()์ ํ๋ ๋์ ๋ฆฌ์คํธ์ ๊ฐ์ 0์ผ๋ก ๋ฐ๊พธ์ด ์ฃผ๋ฉด์ pop()๊ณผ ๊ฐ์ ๊ธฐ๋ฅ์ ๊ตฌํํ๋ค. โ๏ธ์ฝ๋:'''https://www.acmicpc.net/problem/1966๋ฌธ์ : ํ๋ฆฐํฐ ํ๋์ด๋: ์ค๋ฒ3'''def myQueue(n, m, box): cur = 0 # ํ์ฌ ์์น๋ฅผ ๊ฐ๋ฆฌํค๋ ๋ณ์ answer = 0 # pop๋ ํ์, ์ฆ m์ด pop๋์์ ๋ ๊ฐ์ด ์ ๋ต! while True: high_in_box = max(box) if box[cur] >= high_in_box and box[cur.. 2024. 9. 26. [๋ฐฑ์ค 1912๋ฒ] ์ฐ์ํฉ ๐๋ฌธ์ : ๐ํ์ด:์ด์ ์ ์ฐ์ํฉ ๋ฌธ์ ๋ฅผ ํ์์ ๋๋ ๋ถํ ์ ๋ณต ๋ฐฉ์์ผ๋ก ์ต๋ ๋ถ๋ถ ํฉ์ ์๊ฒ ์ชผ๊ฐ์ด ํ์์ผ๋,์ด๋ฒ์ dp ๋ฐฉ์์ผ๋ก ํ์ฌ ๊ฐ์ฅ ํฐ ๊ฐ์ ๊ธฐ์ต(์ ์ฅ?)ํ๋ ๋ฐฉ์์ผ๋ก ํ์ด๋ณด์๋ค.๊ทธ๋ฌ๋, ์ด ๋ฐฉ์์ผ๋ก๋ ์ด๋ ๋ฒ์์์ ์ฐ์ ํฉ์ด ๊ฐ์ฅ ํฐ์ง๋ ์ ์๊ฐ ์์ด, ์ด๋ฌํ ๋ฌธ์ ๊ฐ ๋์จ๋ค๋ฉด ๋ค๋ฅธ ๋ฐฉ๋ฒ์ ์ฌ์ฉํด์ผ ํ ๊ฒ ๊ฐ๋ค. โ๏ธ์ฝ๋:'''https://www.acmicpc.net/problem/1912๋ฌธ์ : ์ฐ์ํฉ๋์ด๋: silver2'''index = int(input())box = list(map(int, input().split()))# ๋ค์ด๋๋ฏน ํ๋ก๊ทธ๋๋ฐcurs, maxs = 0, -1000for i in range(index): curs = max(curs, 0) + box[i] ma.. 2024. 9. 25. [๋ฐฑ์ค 14406๋ฒ] ์ข์ค์ ์ฌ๋ก์ก๋ ๊ฑด๋ฐฐ์ฌ ๐๋ฌธ์ : ๐ํ์ด:์ฒ์ ๋ฌธ์ ๋ฅผ ์ฝ์์ ๋๋ ๋นํฉ์ค๋ฌ์ ์ง๋ง "์ข์ค์ ์ฌ๋ก์ก๋ ๊ฑด๋ฐฐ์ฌ"์ ๋ํด ๊ตฌ๊ธ๋ง ํ ํด๊ฒฐํ ์ ์์๋ค.์คํ์ ์ฃผ์! โ๏ธ์ฝ๋:'''https://www.acmicpc.net/problem/14406๋ฌธ์ : ์ข์ค์ ์ฌ๋ก์ก๋ ๊ฑด๋ฐฐ์ฌ๋์ด๋: ๋ฒ์ธ๋ฌธ์ '''match(input()): case "๊ฑธ.๊ฑธ.๊ฑธ": print("๋ ์ฌ๋ํ ๊ฑธ, ๋ ์ฐธ์๊ฑธ, ๋ ์ฆ๊ธธ๊ฑธ.") case "์ฌ.์ฐ.๋": print("์ฌ๋๊ณผ ์ฐ์ ์ ๋๋์") case "์ง.ํ.์": print("์ง๊ธ๋ถํฐ ํํฉํ์") case "์ฌ.๊ฑด.์ถ": print("์ฌ๋ฏธ์๊ณ ๊ฑด๊ฐํ๊ฒ, ์ถ๋ณตํ๋ฉฐ ์ด์") case "์ค.์ง.์ด": print("์ค๋๋๋ก ์ง๊ทธ.. 2024. 9. 25. ์ด์ 1 2 ๋ค์