250x250
반응형
Notice
Recent Posts
Recent Comments
Link
목록평균 (1)
N

for문만 사용할 줄 알면 풀 수 있는 문제..! for문을 돌면서 answer에 arr에 있는 수를 모두 더한 후, 마지막에 arr.size()만큼 나눠주면 끄으으읕..! #include #include using namespace std; double solution(vector arr) { double answer = 0; for(int i = 0; i < arr.size(); i++) answer += arr[i]; answer /= arr.size(); return answer; }
프로그래머스 알고리즘/1단계
2020. 4. 29. 09:24