#include <bits/stdc++.h> using namespace std;
int main() { int a[10000], x; cin >> x; int maxx = 0; int s = 0; for (int i = 0; i < x; i++) { cin >> a[i]; if (a[i] > maxx) { maxx = a[i]; } } for (int i = 0; i < x; i++) { s = s + maxx-a[i]; } cout << s; return 0; }
使用您的 蒙青创OJ 通用账户