include numeric -> accumulate() 를 쓰면 더 편함.
그러나 본인은 생각이 안나 반복문으로 풀었음.
#include <vector>
using namespace std;
double solution(vector<int> arr) {
double answer = 0;
for (int i = 0; i < arr.size(); i++)
answer += arr[i];
answer /= arr.size();
return answer;
}'Coding_Test 연습 > Programmers' 카테고리의 다른 글
| [프로그래머스] (C++) LV1 핸드폰 번호 가리기 (0) | 2022.04.27 |
|---|---|
| [프로그래머스] (C++) LV1 하샤드 수 (0) | 2022.04.27 |
| [프로그래머스] (C++) LV1 콜라츠 추측 (0) | 2022.04.27 |
| [프로그래머스] (C++) LV1 최대공약수와 최소공배수 (0) | 2022.04.27 |
| [프로그래머스] (C++) LV1 짝수와 홀수 (0) | 2022.04.27 |