fork download
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. double n, Max=0, sum = 0;
  6. //int news;
  7. float a[50];
  8. cin >> n;
  9.  
  10. for (int i = 0; i < n; i++) {
  11. cin >> a[i];
  12.  
  13. if (a[i] >= Max)
  14. Max = a[i];
  15.  
  16. sum += a[i];
  17. }
  18. //for (int i = 0; i < n; i++) {
  19. // a[i] = a[i] / Max * 100;
  20. // sum += a[i];}
  21. // news = sum;
  22. //cout << Max << endl;
  23. //cout << news << endl;
  24. cout << fixed; //소숫점을 고정시켜 표현
  25. cout.precision(2);//() 안의 자리까지 표현 -> 소수점()자리 표현
  26. cout << sum *100 / (3 * Max);
  27. return 0;
  28. }
Success #stdin #stdout 0s 15232KB
stdin
6
10
11
12
13
14
15
stdout
166.67