Advertisement
Guest User

Untitled

a guest
Apr 29th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include <iostream>
  2. #include <String>
  3. using namespace std;
  4. int main()
  5. {
  6.     long n, k;
  7.     cin >> n >> k;
  8.     const long max = 10000;
  9.     long long mas[max];
  10.     long count = n*k;
  11.     int bombi=0;
  12.     for (int x = 0; x < n; x++) {
  13.         cin >> mas[x];
  14.     }
  15.     for (int x = 0; x < n; x++) {
  16.         if (mas[x] <= k) {
  17.             count = count - mas[x];
  18.         }
  19.         else {
  20.             count = count - k;
  21.         }
  22.     }
  23.     for (int x = 0; x < n; x++) {
  24.         if (mas[x] > k) {
  25.             bombi = bombi + (mas[x] - k);
  26.         }
  27.     }
  28.     cout << bombi << " " << count;
  29.     system("pause");
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement