반응형
2562번: 최댓값
9개의 서로 다른 자연수가 주어질 때, 이들 중 최댓값을 찾고 그 최댓값이 몇 번째 수인지를 구하는 프로그램을 작성하시오. 예를 들어, 서로 다른 9개의 자연수 3, 29, 38, 12, 57, 74, 40, 85, 61 이 주어
www.acmicpc.net
# @Author YoungMinKim
# baekjoon
ls=[]
for _ in range(9):
x=int(input())
ls.append(x)
high = max(ls)
for i in range(len(ls)):
if ls[i] == high:
print(high)
print(i+1)
else:
continue
반응형
'백준 문제풀이' 카테고리의 다른 글
| baekjoon - python - 2588 (0) | 2020.08.25 |
|---|---|
| baekjoon - python - 2577 (0) | 2020.08.25 |
| baekjoon - python - 2558 (0) | 2020.08.25 |
| baekjoon - python - 2557 (0) | 2020.08.25 |
| baekjoon - python - 2555 (0) | 2020.08.24 |
댓글