Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Codeforces 758A
- #include <iostream>
- using namespace std;
- int main()
- {
- int n, maxim = 0, rez = 0;
- cin >> n;
- int nn[n];
- for( int i = 0; i < n; i++ )
- {
- cin >> nn[i];
- if ( nn[i] > maxim ){ maxim = nn[i]; }
- }
- for( int y = 0; y < n; y++ )
- {
- if ( nn[y] < maxim ){ rez += maxim - nn[y];}
- }
- cout << rez;
- return 0;
- }
Add Comment
Please, Sign In to add comment