๐ŸŒฑ → ๐ŸŒณ

[๋ฐฑ์ค€] 2562๋ฒˆ: ์ตœ๋Œ“๊ฐ’ python ๋ณธ๋ฌธ

Algorithms

[๋ฐฑ์ค€] 2562๋ฒˆ: ์ตœ๋Œ“๊ฐ’ python

BAY 2022. 7. 10. 21:22
728x90

https://www.acmicpc.net/problem/2562

 

2562๋ฒˆ: ์ตœ๋Œ“๊ฐ’

9๊ฐœ์˜ ์„œ๋กœ ๋‹ค๋ฅธ ์ž์—ฐ์ˆ˜๊ฐ€ ์ฃผ์–ด์งˆ ๋•Œ, ์ด๋“ค ์ค‘ ์ตœ๋Œ“๊ฐ’์„ ์ฐพ๊ณ  ๊ทธ ์ตœ๋Œ“๊ฐ’์ด ๋ช‡ ๋ฒˆ์งธ ์ˆ˜์ธ์ง€๋ฅผ ๊ตฌํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค. ์˜ˆ๋ฅผ ๋“ค์–ด, ์„œ๋กœ ๋‹ค๋ฅธ 9๊ฐœ์˜ ์ž์—ฐ์ˆ˜ 3, 29, 38, 12, 57, 74, 40, 85, 61 ์ด ์ฃผ์–ด

www.acmicpc.net

 

์ •๋‹ต ์ฝ”๋“œ:

dic=[]
for i in range(9):
  dic.append(int(input()))

x = max(dic)
print(x)
print(dic.index(x)+1)

 

์ฒ˜์Œ ์ƒ๊ฐํ•œ ํ’€์ด: 

dic=list(map(int, input().split()))
i = 0 
for i in dic:
  if ..
  i+= 1

ํ•˜์ง€๋งŒ ์ €๋ ‡๊ฒŒ split์œผ๋กœ ๋ถˆ๋Ÿฌ์˜ค๋ฉด, ์ž…๋ ฅ ๋ฐ›์„ ๋•Œ end = "\n "๋กœ ์ž…๋ ฅ์ด ๋˜์–ด์ ธ์„œ ๊ณ ๋ฏผํ–ˆ์Œ

๊ทธ๋ฆฌ๊ณ  ์€๊ทผ ๊ตฌํ˜„ํ•˜๋Š”๊ฒŒ ๋ง‰๋ง‰ํ•ด์„œ ์ฐพ์•„๋ดค๋Š”๋ฐ 

indexํ•จ์ˆ˜๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•์ด ์žˆ์—ˆ๋‹ค๋‹,,

ํ•œ ํ’€์ด์—๋งŒ ๋„ˆ๋ฌด ์ง‘์ฐฉํ•˜๋ ค ํ•˜์ง€๋ง์ž 

์ƒ๊ฐ์„ ๋‹ค์–‘ํ•˜๊ฒŒ ํ•˜๋ ค๊ณ  ๋…ธ๋ ฅํ•˜๊ธฐ 

728x90