https://softeer.ai/practice/info.do?eventIdx=1&psProblemId=389
Softeer
연습문제를 담을 Set을 선택해주세요. 취소 확인
softeer.ai
import sys
n, k = map(int,sys.stdin.readline().split())
score_list = list(map(int,sys.stdin.readline().split()))
for i in range(k):
a,b = map(int,sys.stdin.readline().split())
mean=format(round(sum(score_list[a-1:b])/(b-a+1),2),'.2f')
print(mean)
풀어본 문제중 가장 쉬운 거같다?
참고한 블로그
https://code-code.tistory.com/10
[Python] 소수점 n 번 째 자리까지 0으로 채우기
aa = 1.2 print(format(aa, ".2f")) # 1.20 f = format(aa, '.2f') # 1.20 >> float 형태에서 string 타입으로 변경됩니다.
code-code.tistory.com
반응형
'코딩 > Softeer' 카테고리의 다른 글
[Softeer] [인증평가(1차) 기출] 로봇이 지나간 경로- 파이썬 (0) | 2022.04.11 |
---|---|
[Softeer] 이미지 프로세싱- 파이썬 (0) | 2022.02.14 |
[Softeer] 택배 마스터 광우 - 파이썬 (0) | 2022.02.07 |
[Softeer] 전광판 - 파이썬 (0) | 2022.02.07 |
[Softeer] 비밀메뉴 - 파이썬 (0) | 2022.02.06 |