fork download
  1. #include<bits/stdc++.h>
  2.  
  3. #define pi acos(-1)
  4. #define all(x) (x).begin(),(x).end()
  5. #define fill(x,y) memset(x, y, sizeof(x))
  6. #define trace(x) cout << #x << " = " << x << endl
  7. #define bug cout << "Bug check" << endl
  8. #define endl '\n'
  9.  
  10. using namespace std;
  11.  
  12. int main(){
  13. //freopen("in.txt","r", stdin);
  14. //freopen("out.txt","w", stdout);
  15.  
  16. //ios::sync_with_stdio(0);
  17. //cin.tie(0);
  18.  
  19. int n; cin >> n;
  20.  
  21. vector <int> v(n);
  22.  
  23. for(int&x : v) cin >> x;
  24.  
  25. sort(all(v));
  26.  
  27. n = n/2 + 1;
  28.  
  29. int s = 0;
  30. for(int i=0;i<n;i++){
  31. s+=(v[i]/2)+1;
  32. }
  33. cout << s << endl;
  34.  
  35. return 0;
  36. }
Success #stdin #stdout 0s 4224KB
stdin
3
5 7 5
stdout
6