Skip to content

Instantly share code, notes, and snippets.

@godtaehee
Created January 17, 2019 02:27
Show Gist options
  • Save godtaehee/06933282955aacfff7a4171f3cbeeab5 to your computer and use it in GitHub Desktop.
Save godtaehee/06933282955aacfff7a4171f3cbeeab5 to your computer and use it in GitHub Desktop.
C++
#include <iostream>
using namespace std;
int main(){
cin.tie(NULL);
ios_base::sync_with_stdio(false);
double max, sum =0;
int N;
cin >> N;
int a[N];
for(int i = 0; i < N; i++)
cin >> a[i];
max = a[0];
for(int i = 0; i < N; i++){
if(a[i] > max)
max = a[i];
}
for(int i = 0; i < N; i++)
sum += (a[i] / max) * 100;
cout << sum / N;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment