Algorithm

Algorithm/SWEA

[SWEA - D2] 1945. ๊ฐ„๋‹จํ•œ ์†Œ์ธ์ˆ˜๋ถ„ํ•ด

๋‚˜์˜ ํ’€์ด T = int(input()) # ์—ฌ๋Ÿฌ๊ฐœ์˜ ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค๊ฐ€ ์ฃผ์–ด์ง€๋ฏ€๋กœ, ๊ฐ๊ฐ์„ ์ฒ˜๋ฆฌํ•ฉ๋‹ˆ๋‹ค. for t in range(1, T + 1): n = int(input()) arr = [2,3,5,7,11] print("#"+str(t) , end=" ") for i in arr: cnt = 0 while n%i ==0: cnt += 1 n = n//i print(cnt , end=" ") print() ๋ฐฐ์—ด๋กœ ๋งŒ๋“ค๊ณ  ๋ฐ˜๋ณตํ•˜๊ฒŒ ๋งŒ๋“ค์—ˆ๋‹ค. ๋ฐฐ์—ด ๋ฐ˜๋ณต ์ˆ˜ํ–‰ํ•  ๋•Œ๋งˆ๋‹ค ์นด์šดํ„ฐ ๋ณ€์ˆ˜๋ฅผ ์ดˆ๊ธฐํ™”ํ•˜๊ณ  ๊ฐ’์„ ๊ตฌํ•˜๊ณ  ์ถœ๋ ฅ ๋‹ค๋ฅธํ’€์ด ์ฐพ์•„๋ดค๋Š”๋ฐ ๋ฐฐ์—ด for ๋ฌธ์— while ์กฐ๊ฑด๋„ฃ์–ด์„œ ๊ตฌํ•˜๊ธฐ ๋Œ€๋ถ€๋ถ„ ์ด๋ ‡๊ฒŒ ํ‘ธ๋Š”๋“ฏ?

Algorithm/SWEA

[SWEA] D1 ๋ฌธ์ œํ’€์ด

19๋ฌธ์ œ ํ’€์ด ์™„๋ฃŒ ์˜ค๋žœ๋งŒ์— ๋ฌธ์ œํ‘ธ๋‹ˆ๊นŒ ๋‹ค ๊นŒ๋จน์—ˆ๋„ค; format ํ™œ์šฉ {} ๋ฅผ ํ™œ์šฉํ•˜์—ฌ ๋ฐ์ดํ„ฐ์˜ ์ข…๋ฅ˜์— ์ƒ๊ด€์—†์ด print๋ฌธ์œผ๋กœ ํ‘œํ˜„์ด ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. print("์˜ฌํ•ด๋Š” {}๋…„, ๋‚ด๋…„์€ {}๋…„ ์ž…๋‹ˆ๋‹ค.".format(2020, 2021)) print("๋‚˜๋Š” {}์„ ํƒ‘๋‹ˆ๋‹ค.".format('์ง€ํ•˜์ฒ ')) ord( ๋ฌธ์ž ) : ์•„์Šคํ‚ค์ฝ”๋“œ๋กœ ๋Œ€์ƒ์˜ ์ˆซ์ž ๊ฐ’์„ ๋ฆฌํ„ดํ•จ chr( ์ˆซ์ž ) : ์•„์Šคํ‚ค์ฝ”๋“œ์—์„œ ๋Œ€์ƒ์˜ ๋ฌธ์ž ๊ฐ’์„ ๋ฆฌํ„ดํ•จ 2056. ์—ฐ์›”์ผ ๋‹ฌ๋ ฅ ๋‚˜์˜ ํ’€์ด T = int(input()) for t in range(1, T + 1): cal = input() year = (cal[0:4]) mon = cal[4:6] day = cal[6:8] if int(mon) >= 13 or int(mon) == 0 : r..

hello_u
'Algorithm' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก (6 Page)