Skip to content

Instantly share code, notes, and snippets.

@shohan4556
Created March 12, 2015 18:17
Show Gist options
  • Save shohan4556/c12a3952948381efeef0 to your computer and use it in GitHub Desktop.
Save shohan4556/c12a3952948381efeef0 to your computer and use it in GitHub Desktop.
URI OJ problem 1436 solution in C
/// URI : 1436
/// Author : Shohanur Rahaman
#include<stdio.h>
int main()
{
int tc,n,i,tmp,j;
int player[9];
int t=0;
scanf("%d",&tc);
while(tc--){
t++;
scanf("%d",&n);
tmp=0;
for(i=0;i<n;i++){
scanf("%d",&player[i]);
}
// sort array
for(i=0;i<n;i++){
for(j=i;j<n;j++){
if(player[i]>=player[j]){
tmp=player[i];
player[i]=player[j];
player[j]=tmp;
}
}
}
tmp=n/2;
printf("Case %d: %d\n",t,player[tmp]);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment