CS/Algorithm
[Python : 2562] 최대값
yujindonut
2022. 2. 8. 00:22
728x90
https://www.acmicpc.net/problem/2562
2562번: 최댓값
9개의 서로 다른 자연수가 주어질 때, 이들 중 최댓값을 찾고 그 최댓값이 몇 번째 수인지를 구하는 프로그램을 작성하시오. 예를 들어, 서로 다른 9개의 자연수 3, 29, 38, 12, 57, 74, 40, 85, 61 이 주어
www.acmicpc.net
max = 0
index = 0
for i in range(9):
n = int(input())
if max < n:
max = n
index = i + 1
print(max)
print(index)
728x90