Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#5 2108 통계학 #5

Open
yongholeeme opened this issue Mar 17, 2019 · 0 comments
Open

#5 2108 통계학 #5

yongholeeme opened this issue Mar 17, 2019 · 0 comments
Labels
4-5주차 19-1 19-1 Problem Solving

Comments

@yongholeeme
Copy link

yongholeeme commented Mar 17, 2019

Problem

수를 처리하는 것은 통계학에서 상당히 중요한 일이다. 통계학에서 N개의 수를 대표하는 기본 통계값에는 다음과 같은 것들이 있다. 단, N은 홀수라고 가정하자.

  1. 산술평균 : N개의 수들의 합을 N으로 나눈 값
  2. 중앙값 : N개의 수들을 증가하는 순서로 나열했을 경우 그 중앙에 위치하는 값
  3. 최빈값 : N개의 수들 중 가장 많이 나타나는 값
  4. 범위 : N개의 수들 중 최댓값과 최솟값의 차이 .

N개의 수가 주어졌을 때, 네 가지 기본 통계값을 구하는 프로그램을 작성하시오.

입력 설명

첫째 줄에 수의 개수 N(1 ≤ N ≤ 500,000)이 주어진다. 그 다음 N개의 줄에는 정수들이 주어진다.
입력되는 정수의 절댓값은 4,000을 넘지 않는다.

출력 설명

첫째 줄에는 산술평균을 출력한다. 소수점 이하 첫째 자리에서 반올림한 값을 출력한다.
둘째 줄에는 중앙값을 출력한다.
셋째 줄에는 최빈값을 출력한다. 여러 개 있을 때에는 최빈값 중 두 번째로 작은 값을 출력한다.
넷째 줄에는 범위를 출력한다.

입력 및 출력 예제

# 예제 입력1
5
1
3
8
-2
2

# 예제 출력1
2
2
1
10

----------------------------------------------

# 예제 입력2
1
4000

# 예제 출력2
4000
4000
4000
0

----------------------------------------------

# 예제 입력3
5
-1
-2
-3
-1
-2

# 예제 출력3
-2
-2
-1
2

언어제한

  • C/C++
  • Python3

문제 출처

https://www.acmicpc.net/problem/2108

@yongholeeme yongholeeme added 19-1 19-1 Problem Solving 4-5주차 and removed labels Mar 17, 2019
@yongholeeme yongholeeme changed the title [problem] 통계학 [problem] 2108 통계학 Mar 28, 2019
@yongholeeme yongholeeme changed the title [problem] 2108 통계학 #5 2108 통계학 Mar 29, 2019
yongholeeme pushed a commit that referenced this issue Apr 8, 2019
Solve #5 2108 통계학 & #6 2581 소수
yongholeeme pushed a commit that referenced this issue Apr 8, 2019
yongholeeme pushed a commit that referenced this issue Apr 8, 2019
yongholeeme pushed a commit that referenced this issue Apr 8, 2019
Solve #5 2108 통계학 & #6 2581 소수
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4-5주차 19-1 19-1 Problem Solving
Projects
None yet
Development

No branches or pull requests

1 participant