![[C++] 백준 13단계 - 2587번 문제 (대표값2)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2FdnaolI%2FbtsnF5DIWJc%2FAAAAAAAAAAAAAAAAAAAAAKY8_VItDSXTKWY_-ya6475KApswPiFBGs3dBqjjmruQ%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1753973999%26allow_ip%3D%26allow_referer%3D%26signature%3D2wtoxd72rLUQn3qye6D5JaOasl4%253D)
[C++] 백준 13단계 - 2587번 문제 (대표값2)자료구조 & 알고리즘/BOJ2023. 7. 14. 18:32
Table of Contents
문제설명
소스코드
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int arr[5]; int sum = 0;
for (int i = 0; i < 5; ++i)
{
cin >> arr[i];
sum += arr[i];
}
sort(arr, arr + 5);
cout << sum / 5 << endl;
cout << arr[2];
}
'자료구조 & 알고리즘 > BOJ' 카테고리의 다른 글
[C++] 백준 13단계 - 1427번 문제 (소트인사이드) (0) | 2023.07.16 |
---|---|
[C++] 백준 13단계 - 10989번 문제 (커트라인) (0) | 2023.07.15 |
[C++] 백준 13단계 - 10989번 문제 (수 정렬하기 3) (0) | 2023.07.14 |
[C++] 백준 13단계 - 2751번 문제 (수 정렬하기 2) (0) | 2023.07.13 |
[C++] 백준 13단계 - 2750번 문제 (수 정렬하기) (0) | 2023.07.13 |