Advertisement
erfanul007

Timus 1025

Apr 14th, 2021
667
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #include<stdio.h>
  2. //resubmission
  3. int main()
  4. {
  5.     int j,i,n,x[105],temp,s;
  6.     scanf("%d",&n);
  7.     for(i=0;i<n;i++){
  8.         scanf("%d",&x[i]);
  9.     }
  10.     for(i=0;i<n;i++){
  11.         for(j=i+1;j<n;j++){
  12.             if(x[i]>x[j]){
  13.                 temp=x[i];
  14.                 x[i]=x[j];
  15.                 x[j]=temp;
  16.             }
  17.         }
  18.     }
  19.     s=0;
  20.     for(i=0;i*2<n;i++){
  21.         s=s+(x[i]+2)/2;
  22.     }
  23.     printf("%d\n",s);
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement