Advertisement
rengetsu

Timus_1025

Jul 21st, 2018
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. //Timus 1025
  2. #include <cmath>
  3. #include <iostream>
  4. using namespace std;
  5. int main()
  6. {
  7.     double k, s, nn[101], sub, answ=0;
  8.     cin >> k;
  9.     s=ceil(k/2);
  10.     for(int i=0;i<k;i++)
  11.     {
  12.         cin >> nn[i];
  13.     }
  14.     for(int i=0;i<k;i++)
  15.     {
  16.         for(int y=0;y<k-1;y++)
  17.         {
  18.             if(nn[y]>nn[y+1])
  19.             {
  20.                 sub = nn[y];
  21.                 nn[y] = nn[y+1];
  22.                 nn[y+1] = sub;
  23.             }
  24.         }
  25.     }
  26.     for(int i=0;i<s;i++)
  27.     {
  28.         answ+=ceil(nn[i]/2);
  29.     }
  30.     cout << answ;
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement