Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- 오에스
- OS
- coding
- bfs
- c++
- Stack
- 정석
- 알고리즘
- DP
- 스택
- 북리뷰
- 코딩
- 브루트포스
- 컴공
- Operating System
- 문제풀이
- 너비우선탐색
- 정석학술정보관
- 개발
- 그래프
- 백준
- 구현
- 컴퓨터공학과
- 오퍼레이팅시스템
- 자료구조
- cs
- Computer science
- 컴공과
- 코테
- vector
Archives
- Today
- Total
Little Jay
[C++] 백준 2587번 대표값2 본문
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int input;
int sum = 0, average = 0;
vector<int> arr;
for (int i = 0; i < 5; i++) {
cin >> input;
sum += input;
arr.push_back(input);
}
average = sum / 5;
sort(arr.begin(), arr.end());
cout << average << "\n" << arr[2] << "\n";
return 0;
}
'알고리즘 > BOJ' 카테고리의 다른 글
[C++] 백준 2566번 최댓값 (0) | 2021.03.06 |
---|---|
[C++] 백준 2511번 카드놀이 (0) | 2021.03.06 |
[C++] 백준 2750번 수 정렬하기 (0) | 2021.03.05 |
[C++] 백준 2593번 대표값 (0) | 2021.03.04 |
[C++] 백준 2748번 피보나치 수 2 (0) | 2021.03.04 |
Comments