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 | 31 |
Tags
- vector
- c++
- DP
- Operating System
- bfs
- 북리뷰
- 코테
- 오퍼레이팅시스템
- Computer science
- 자료구조
- 스택
- 오에스
- 구현
- 컴공과
- 코딩
- 컴공
- 백준
- 컴퓨터공학과
- 그래프
- 너비우선탐색
- 정석
- OS
- 문제풀이
- 브루트포스
- coding
- Stack
- 알고리즘
- cs
- 정석학술정보관
- 개발
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