Guest User

ZCO14003 #2

a guest
Dec 31st, 2019
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. #include<iostream>
  2. typedef long long ll;
  3. int sort(int A[],long long p){
  4.     for (int i=0;i<p-1;i++){
  5.         for(int k=0;k<p-i-1;k++){
  6.             if (A[i] > A[i+1]){
  7.                 int j = A[i];
  8.                 A[i] = A[i+1];
  9.                 A[i+1] = j;
  10.             }
  11.         }
  12.     }
  13. }
  14. using namespace std;
  15. int main(){
  16.     ios::sync_with_stdio(0);
  17.     cin.tie(0);
  18.     ll N; //number of customers
  19.     scanf("%lld",&N);
  20.     int budget[N]; //Budgets of customers
  21.     for (int i=0;i<N;i++){
  22.         cin >> budget[i];
  23.     }
  24.     sort(budget,N);
  25.     int Average[N];
  26.     for (int i=1;i<N;i++){
  27.         Average[0] = 0;
  28.         Average[i] += budget[i]/i;
  29.     }
  30.     sort(Average,N);
  31.     cout << Average[N];
  32. }
Add Comment
Please, Sign In to add comment