[Python] 백준 2562 : 최댓값
https://www.acmicpc.net/problem/2562 2562번: 최댓값 9개의 서로 다른 자연수가 주어질 때, 이들 중 최댓값을 찾고 그 최댓값이 몇 번째 수인지를 구하는 프로그램을 작성하시오. 예를 들어, 서로 다른 9개의 자연수 3, 29, 38, 12, 57, 74, 40, 85, 61 이 주어 www.acmicpc.net count = 0 tmp = 0 list = [] for i in range(9): list.append(int(input())) if list[i] > tmp: tmp = list[i] count = i + 1 print(tmp) print(count) 코드 해석 count = 0 tmp = 0 list = [] count => 최댓값이 저장된 배열의 번째수 저장..
[Python] 백준 10818 최소, 최대
https://www.acmicpc.net/problem/10818 10818번: 최소, 최대 첫째 줄에 정수의 개수 N (1 ≤ N ≤ 1,000,000)이 주어진다. 둘째 줄에는 N개의 정수를 공백으로 구분해서 주어진다. 모든 정수는 -1,000,000보다 크거나 같고, 1,000,000보다 작거나 같은 정수이다. www.acmicpc.net n = int(input()) a = list(map(int,input().split())) min = a[0] max = a[0] for i in range(n): if max a[i]: min = a[i] print(min,max) n = lnt(input()) a = list(map(int,input().s..