MapleStory Finger Point

๐Ÿƒ‍โ™‚๏ธBaekjoon 128

#2563 -python

N = int(input()) #์ƒ‰์ข…์ด ๊ฐœ์ˆ˜arr = [[0 for _ in range (100)] for _ in range(101)]for _ in range (N): x,y = list(map(int,input().split())) #๊ฐ’ ๋ฐ›์•„์˜ค๊ธฐ for row in range(x,x+10): # 10 x 10 ๊ณ ์ • ๊ฐ’ for col in range (y,y+10): arr[row][col] = 1 #์ƒ‰์ข…์ด์˜ ๋„“์ด ํ‘œํ˜„ result = 0for i in arr: result += i.count(1)print(result) 2์ฐจ์›๋ฐฐ์—ด์˜ ์ดˆ๊ธฐ๊ฐ’์€ 0์œผ๋กœ ์žก์•„์ฃผ๊ณ x ~ x+10 ๋งŒํผ 1์„ ์ฐ์–ด์ค˜์„œ ์ƒ‰์ข…์ด์˜ ๋„“์ด๋ฅผ ํ‘œํ˜„ํ•ด์ค€๋‹ค.์ดํ›„ 1์˜ ๊ฐœ์ˆ˜๋งŒ ์„ธ์–ด์ฃผ๋ฉด ๋„“..

#25206 - python

#ํ•™์  X ๊ณผ๋ชฉ ํ‰์  / ํ•™์ ์˜ ์ดํ•ฉ object, score, rating = [],[],[] rating_list = {"A+":4.5,"A0":4.0,"B+":3.5,"B0":3.0,"C+":2.5,"C0":2.0,"D+":1.5,"D0":1.0,"F":0.0} score_sum = 0 scra = 0 # ํ•™์  X ๊ณผ๋ชฉ ํ‰์  cnt = 0 for _ in range (20) : object, score, rating = input().split() score = float(score) if rating != "P": scra += score*rating_list.get(rating) score_sum += score print(format(scra/score_sum,".6f")) ๐Ÿ’ฌ score ๊ฐ’์„..

#1316 - python

N = int(input()) cnt = N for i in range(N): list = input() for j in range(0, len(list)-1): if list[j] == list[j+1]: pass elif list[j] in list[j+1:]: cnt -= 1 break print(cnt) ๐Ÿ’ฌ ์—ฐ์†๋œ ๋ฌธ์ž ํ™•์ธํ•˜๋Š” ์•Œ๊ณ ๋ฆฌ์ฆ˜์„ ์•Œ์•„์•ผํ•จ. for i in range(len(s) - 1): if s[i] == s[i + 1]: return True ์ˆœํšŒ ์ฒ˜๋ฆฌ๋ฅผ ์œ„ํ•œ len(s) - 1 ์•ž ๋’ค๋ฅผ ๋น„๊ตํ–ˆ์„๋•Œ ์ฐธ์ด๋ฉด ์—ฐ์†๋˜๋Š” ๋ฌธ์ž ๐Ÿ’ฌ ๊ฐ’์ด ๋‹ค๋ฅผ ๊ฒฝ์šฐ ์ฒ˜๋ฆฌ ๋ฐฉ๋ฒ• 0๋ฒˆ์งธ ๋ฌธ์ž๊ฐ€ ([0+1:] 1๋ฒˆ์งธ ~ 3๋ฒˆ์งธ ์ธ๋ฑ์Šค ๊นŒ์ง€ ๋น„๊ตํ•ด์„œ ) ๋’ค์ชฝ์— ๊ฐ’์ด ์žˆ๋Š”๊ฐ€? True -> cnt -1 ( ๊ทธ๋ฃน ๋‹จ์–ด์—..

#2941 - python

s = input() #๋ฌธ์ž์—ด๋ฐ›๊ธฐ list = ["c=", "c-", "dz=", "d-","lj", "nj", "s=", "z="] for i in list : s = s.replace(i,"#") #ํ•ด๋‹น ๊ฐ’๋“ค์„ #์œผ๋กœ ์น˜ํ™˜์‹œ์ผœ์„œ 1๊ฐœ ๊ฐœ์ˆ˜๋กœ ์„ธ์–ด์ง€๋„๋กํ•œ๋‹ค. print(len(s)) ์ด ๋ฌธ์ œ์˜ ํ•ต์‹ฌ์€ ์น˜ํ™˜์ด๋‹ค ! c= dz= ๋“ฑ๋“ฑ ๋‘์ž๋ฆฌ ์„ธ์ž๋ฆฌ ๊ฐ’๋“ค์„ ๋น„๊ตํ•˜๊ธฐ์—” ๋ณต์žกํ•˜๋‹ค. ๊ทธ๋ž˜์„œ ํ•ด๋‹น ๊ฐ’๋“ค์„ ์ž„์˜์˜ ๋ฌธ์ž๋กœ ๋ฐ”๊ฟ”์ฃผ๋Š” ๊ฒƒ์ด๋‹ค. => # ๊ทธ๋Ÿด๊ฒฝ์šฐ ์ผ๋ฐ˜ ์•Œ๋ฐ”๋ฒณ๋“ค๊ณผ # ์„ len ์ฒ˜๋ฆฌํ•ด์„œ ์ถœ๋ ฅ๋งŒ ํ•ด์ฃผ๋ฉด ๋œ๋‹ค. ๐Ÿ’ฌ replace() ํ•จ์ˆ˜๋Š” ๋ฌธ์ž์—ด์—์„œ ํŠน์ • ๋ถ€๋ถ„ ๋ฌธ์ž์—ด์„ ๋‹ค๋ฅธ ๋ฌธ์ž์—ด๋กœ ์น˜ํ™˜ (์น˜ํ™˜๋œ ๊ฒฐ๊ณผ๋ฅผ ์ƒˆ๋กœ์šด ๋ณ€์ˆ˜์— ์ €์žฅํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์›๋ณธ ๋ฌธ์ž์—ด์€ ๋ณ€๊ฒฝ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค) s.replace("apple", "pear")