rengetsu

Codeforces_758A

Jul 12th, 2019
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. // Codeforces 758A
  2.  
  3. #include <iostream>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     int n, maxim = 0, rez = 0;
  10.     cin >> n;
  11.     int nn[n];
  12.     for( int i = 0; i < n; i++ )
  13.     {
  14.         cin >> nn[i];
  15.         if ( nn[i] > maxim ){ maxim = nn[i]; }
  16.     }
  17.     for( int y = 0; y < n; y++ )
  18.     {
  19.         if ( nn[y] < maxim ){ rez += maxim - nn[y];}
  20.     }
  21.     cout << rez;
  22.     return 0;
  23. }
Add Comment
Please, Sign In to add comment