Created
July 18, 2019 11:06
-
-
Save glowing713/a9d955ab29f86ec5ecb2e2e799dbf6f5 to your computer and use it in GitHub Desktop.
백준 1546번 평균
This file contains 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> | |
using namespace std; | |
int main(void){ | |
const int SIZE = 1000; | |
int num = 0, max = 0; | |
double sum = 0; | |
int arr[SIZE] = {0,}; | |
cin >> num; | |
for(int i = 0; i < num; i++){ | |
cin >> arr[i]; | |
} | |
for(int j = 0; j < num; j++){ | |
if(arr[j] > max) max = arr[j]; | |
} | |
for(int k = 0; k < num; k++){ | |
sum += ((double)arr[k]/max)*100; | |
} | |
printf("%.2f\n", sum/num); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment