SHARE
TWEET

Untitled

llownall Mar 20th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4. int x, i, j, t, otvet = 0, maxi = 0;
  5. int main() {
  6.     cin >> x;
  7.     int *a = new int[x], *orig = new int[x];
  8.     for (i = 0; i < x; i++) {
  9.         cin >> a[i];
  10.         orig[i] = 0;
  11.     }
  12.     for (i = 0; i < x; i++) {
  13.         for (j = 0; j < x; j++) {
  14.             if (a[i] == a[j])
  15.             {
  16.                 orig[i]++;
  17.                 if (orig[i] > maxi) {
  18.                     maxi = orig[i];
  19.                 };
  20.             };
  21.         };
  22.         otvet += (maxi - orig[i]);
  23.     }
  24.     cout << otvet << "\n";
  25.    
  26.     system("pause");
  27.     return 0;
  28. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top