MapleStory Finger Point

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

#1157 - python

s = input().upper() #๋ฌธ์ž์—ด ์ „์ฒด ๋Œ€๋ฌธ์ž๋กœ ๋ฐ”๊ฟ”์ฃผ๊ธฐ ZzA s_list = list(set(s)) #ZA cnt = [] count = 0 for i in s_list : count = s.count(i) # Z 2 cnt.append(count)# 2, 1 if cnt.count(max(cnt)) > 1 : # print("?") else : print(s_list[(cnt.index(max(cnt)))]) 1. ๋ฌธ์ž์—ด์„ ์ „๋ถ€ ๋Œ€๋ฌธ์ž๋กœ ๋ฐ”๊ฟ”์ค€๋‹ค. => ์—ฐ์‚ฐํ•˜๊ธฐ ํŽธํ•˜๋„๋ก ( count() ๋ฉ”์„œ๋“œ๋Š” ๋Œ€์†Œ๋ฌธ์ž๋ฅผ ๊ตฌ๋ถ„ํ•˜๊ธฐ๋•Œ๋ฌธ์—) 2. ์ค‘๋ณต๋œ ๊ธ€์ž๋ฅผ ์—†์• ๊ธฐ :: ๋ฌธ์ž์—ด์— ์žˆ๋Š” ๋ฌธ์ž ์ข…๋ฅ˜ 1๊ฐ€์ง€์”ฉ๋งŒ s_list ์— ๋„ฃ์–ด๋‘”๋‹ค. 3. s.count(i) ๋ฅผ ํ†ตํ•ด s ๋ฆฌ์ŠคํŠธ์— s_list[0] ๊ฐ’์ด ๋ช‡..

#2444 - python

n = int(input()) # 2 * n-1 for i in range (0,n,1) : for j in range (n-i,1,-1): print(" ",end="") for j in range (0,i+1,+1): print("*", end="") for j in range (1,i+1,+1): print("*", end="") print( ) for i in range (1,n,+1) : for j in range (0,i,+1): print(" ",end="") for j in range (n-i,0,-1): print("*", end="") for j in range (n-i-1,0,-1): print("*", end="") print( ) C ์–ธ์–ด๋กœ ํ’€๋•Œ๋งˆ๋ƒฅ ํ’€์–ด๋ฒ„๋ ค์„œ ๊ทธ๋Ÿฐ๊ฐ€ ๊ธธ์ด๊ฐ€ ๊ธธ์–ด์ง€..

#11718 - python

while True: try: print(input()) except EOFError: break ์–ผ๋งˆ๋‚˜ ์ž…๋ ฅ๋ฐ›์„์ง€ ์กฐ๊ฑด์ด ๋‚˜์™€์žˆ์ง€ ์•Š๋‹ค. ๊ทธ๋ž˜์„œ while ๋ฌธ์œผ๋กœ ์ž…๋ ฅ์„ ๊ณ„์†ํ•ด์„œ ๋ฐ›๋ฐ ์–ด์จŒ๋“  while ๋ฌธ์ด ๋๋‚˜๋ ค๋ฉด ๊ทธ ๋์„ ์•Œ์•„์•ผํ•จ ์ฆ‰ => EOF (End of File) ๋ฅผ ์•Œ๋ฉด ๋จ. EOF์—๋Ÿฌ๋ฅผ ์ฒ˜๋ฆฌํ•ด์ฃผ๋ฉด ๋จ. ๐Ÿ’ฌ "EOF ์—๋Ÿฌ(End of File ์—๋Ÿฌ)" : ํ”„๋กœ๊ทธ๋žจ์ด ํŒŒ์ผ์˜ ๋์„ ๋งŒ๋‚˜์ง€ ๋ชปํ•˜์—ฌ ๋ฐœ์ƒํ•˜๋Š” ์˜ค๋ฅ˜์ž…๋‹ˆ๋‹ค. ๐Ÿ’ฌ 1) try-except ๋ฌธ ์‚ฌ์šฉ . EOFError ์˜ˆ์™ธ ์žก์•„์ฃผ๊ธฐ ๐Ÿ’ฌ 2) ํŒŒ์ผ ์ฝ์„ ๋•Œ EOF ์—๋Ÿฌ ์žก๊ธฐ : ํŒŒ์ผ์„ ์ฝ์„ ๋•Œ EOF ์—๋Ÿฌ๋ฅผ ๋ฐฉ์ง€ํ•˜๊ธฐ ์œ„ํ•ด readline() ๋˜๋Š” readlines() ํ•จ์ˆ˜๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  EOF ์—๋Ÿฌ๋ฅผ ์ฒ˜๋ฆฌํ•ฉ๋‹ˆ๋‹ค.

#5622 ๋‹ค์ด์–ผ - python

alp = ['ABC','EDF','GHI','JKL','MNO','PQRS','TUV','WXYZ'] A = input() sec = 0 for i in range (len(A)): for j in alp: #abc ~ wxyz ๊นŒ์ง€ ๋Œ๋ฆฌ๊ธฐ if A[i] in j: # a[i] ๋ž‘ ์ ‘์  ์ฐพ๊ธฐ sec += alp.index(j) + 3 #ํ•ด๋‹น ์ธ๋ฑ์Šค ๊ฐ’์— + 3์„ ํ•ด์ฃผ๋ฉด ๋œ๋‹ค. print(sec) ๊ทœ์น™ ! 1๋ฒˆ -> 2์ดˆ 2๋ฒˆ (index = 0 ) => 3์ดˆ 3๋ฒˆ (index = 1) => 4์ดˆ 9๋ฒˆ (index = 7) => 10์ดˆ + 3์˜ ๊ทœ์น™์ด ์žˆ๋‹ค. ์ด ์ ์„ ์‚ฌ์šฉํ•ด์„œ ์ฝ”๋”ฉํ•œ ๊ฒƒ ๐Ÿ’ฌ index() : ํ•ด๋‹น ์š”์†Œ๊ฐ€ ์ฒ˜์Œ์œผ๋กœ ๋“ฑ์žฅํ•˜๋Š” ์œ„์น˜์˜ ์ธ๋ฑ์Šค๋ฅผ ๋ฐ˜ํ™˜ > A = input() sec = 0 #1๋ฒˆ..

#1152 #2908 - python

๋ฐฉ๋ฒ• 1 print(len(input().split())) ๋ฐฉ๋ฒ• 2 S = input() tmp = [] tmp = S.split() print (len(tmp)) ๐Ÿ’ฌ split() : split() ํ•จ์ˆ˜๋Š” ๊ณต๋ฐฑ์„ ๊ธฐ์ค€์œผ๋กœ ๊ฐ’์„ ๋ถ„๋ฆฌํ•˜์—ฌ ๋ฆฌ์ŠคํŠธ๋กœ ๋ฐ˜ํ™˜ํ•˜๋Š”๋ฐ ์ด๊ฑธ ์ด์šฉํ•ด์„œ ๐Ÿ’ฌ len() : ํ•ด๋‹น ๋ฆฌ์ŠคํŠธ์˜ ๊ฐ’์„ len() ํ•จ์ˆ˜๋กœ ๋ฝ‘์•„์ฃผ๋ฉด ๋ฌธ์ž์—ด์˜ ๋‹จ์–ด ๊ฐœ์ˆ˜๋ฅผ ์•Œ์•„๋‚ผ ์ˆ˜ ์žˆ๋‹ค. A,B = input().split() tmp = [] i = 1 # 123 0,1,2 = 3 A = A[::-1] B = B[::-1] if A > B : print (A) else : print (B) ๐Ÿ’ฌ[::-1] ์Šฌ๋ผ์ด์‹ฑ์„ ์‚ฌ์šฉํ•ด ๋ฌธ์ž์—ด์„ ๊ฑฐ๊พธ๋กœ ๋งŒ๋“ค์–ด์ค€๋‹ค.