반응형
요약 : 케이스 값 입력 후 값만큼 성적 입력, 모든 점수를 (점수/최고점)*100 로 바꾼다음 평균을 출력한다.
소스코드
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
|
#include <iostream>
#include <cstdio>
using namespace std;
int main(void) {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int C,num;
float result = 0,array[1000] = {0,};
int max = -1;
cin >> C;
for(int i=0;i<C;i++) {
cin >> num;
array[i] = num;
if(max<array[i]) max = array[i];
}
for(int i=0;i<C;i++) {
result += (array[i]/max)*100;
}
cout << result/C << endl;
return 0;
}
|
cs |
정답 확인
반응형
'category > 백준 알고리즘 c++' 카테고리의 다른 글
백준 알고리즘 24479번 알고리즘 수업 - 깊이 우선 탐색 1 (0) | 2023.02.14 |
---|---|
백준 알고리즘 1002번 터렛 (0) | 2023.02.14 |
백준 알고리즘 4344번 평균은 넘겠지 c++ (0) | 2021.01.20 |
백준 알고리즘 8958번 OX퀴즈 c++ (0) | 2021.01.20 |
백준 알고리즘 3052번 나머지 c++ (0) | 2020.12.13 |
백준 알고리즘 2577번 숫자의 개수 c++ (0) | 2020.12.13 |
백준 알고리즘 2562번 최대 c++ (0) | 2020.12.13 |
백준 알고리즘 10818번 최소, 최대 c++ (0) | 2020.12.13 |
댓글