728x90
반응형
2063.중간값 찾기/
2063.중간값 찾기/
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
T = 1
for tc in range(1,T+1):
N = int(input()) # 항상 홀수
numlst = list(map(int,input().split()))
mid = 0
for i in range(len(numlst)-1): #선택 정렬 완료
min = i
for j in range(i+1, len(numlst)):
if numlst[j] < numlst[min]:
min = j
numlst[i], numlst[min] = numlst[min], numlst[i]
print(numlst)
#print("#{} {}".format(tc, numlst[mid] ))
|
cs |
2068.최대수 구하기
1
2
3
4
5
6
7
8
|
T = int(input())
for tc in range(1,T+1):
numbers = list(map(int,input().split()))
maxV = 0
for i in range(len(numbers)):
if maxV <= numbers[i]:
maxV = numbers[i]
print("#{} {}".format(tc, maxV))
|
cs |
2070.큰 놈 작은 놈, 같은 놈
1
2
3
4
5
6
7
8
9
10
11
12
|
T = int(input())
for tc in range(1, T+1):
temp = 0
n1 = list(map(int,input().split()))
if n1[0] == n1[1]:
temp = '='
elif n1[0] < n1[1]:
temp = '<'
elif n1[0] > n1[1]:
temp = '>'
print("#{} {}".format(tc, temp))
|
cs |
2071. 평균값 구하기
1
2
3
4
5
6
7
8
9
10
|
T = int(input())
avg = 0
for tc in range(1, T+1):
temp = 0
u = list(map(int, input().split()))
for i in range(0,10):
temp += u[i]
avg = temp/len(u)
print("#{} {}".format(tc, round(avg)))
|
cs |
일요일날은 간단한 D1 문제로 마무리
728x90
반응형
'알고리즘 > SWAE' 카테고리의 다른 글
[Python] (D2) 4871.그래프 경로 // DFS 응용 문제 (0) | 2021.03.02 |
---|---|
[Python] - D2 - 2005. 파스칼의 삼각형 (0) | 2021.02.23 |
[SWAE-Python] 4861. 회문1/4864. 문자열 비교/4865. 글자수 (0) | 2021.02.18 |
[SWAE-Python] 2072. 홀수만 더하기, 1986. 지그재그 숫자, 1926. 간단한 369게임 (0) | 2021.02.15 |
[SWAE-Python] 6485. 삼성시의 버스노선, 1959. 두개의 숫자열 (2) | 2021.02.15 |