문제 링크입니다: www.acmicpc.net/problem/10039
10039번: 평균 점수
입력은 총 5줄로 이루어져 있고, 원섭이의 점수, 세희의 점수, 상근이의 점수, 숭이의 점수, 강수의 점수가 순서대로 주어진다. 점수는 모두 0점 이상, 100점 이하인 5의 배수이다. 따라서, 평균 점
www.acmicpc.net
간단한 구현 문제였습니다.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <algorithm> | |
using namespace std; | |
const int MAX = 5; | |
const int MIN_SCORE = 40; | |
int main(void) | |
{ | |
ios_base::sync_with_stdio(0); | |
cin.tie(0); | |
int sum = 0; | |
for (int i = 0; i < MAX; i++) | |
{ | |
int score; | |
cin >> score; | |
sum += max(score, MIN_SCORE); | |
} | |
int average = sum / MAX; | |
cout << average << "\n"; | |
return 0; | |
} |


개발환경:Visual Studio 2017
지적, 조언, 질문 환영입니다! 댓글 남겨주세요~
반응형
'알고리즘 > BOJ' 카테고리의 다른 글
[KOI 초등부] 백준 10156번 과자 (0) | 2021.03.14 |
---|---|
백준 10101번 삼각형 외우기 (0) | 2021.03.14 |
백준 9524번 Beautiful Yekaterinburg (0) | 2021.03.14 |
백준 9498번 시험 성적 (0) | 2021.03.14 |
백준 8723번 Patyki (0) | 2021.03.14 |