Advertisement
StoneHaos

511

Nov 3rd, 2019
343
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.41 KB | None | 0 0
  1. //511
  2. #include <cstdio>
  3. #include <algorithm>
  4. using namespace std;
  5.  
  6. int main(void) {
  7.     freopen("input.txt", "r", stdin);
  8.     freopen("output.txt", "w", stdout);
  9.  
  10.     int n;
  11.     scanf("%d", &n);
  12.     int a[n];
  13.     for (int i = 0; i < n; ++ i)
  14.         scanf("%d", a + i);
  15.     int m = *max_element(a, a + n);
  16.     for (int i = 0; i < n; ++ i) {
  17.         printf("%d", m - a[i]);
  18.         if (i == n - 1)
  19.             printf("\n");
  20.         else
  21.             printf(" ");
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement