Skip to content

Instantly share code, notes, and snippets.

@VoQn
Created October 9, 2011 22:25
Show Gist options
  • Save VoQn/1274290 to your computer and use it in GitHub Desktop.
Save VoQn/1274290 to your computer and use it in GitHub Desktop.
AOJ V0 0001
#include <stdio.h>
int cmp(const void *a, const void *b){
return -(*(int*)a - *(int*)b);
}
int main(void) {
int i, height;
int l = 10;
int hills[l];
for (i = 0; i < l; i++) {
scanf("%d", &height);
hills[i] = height;
}
qsort(hills, l, sizeof(int), cmp);
for (i = 0; i < 3; i++) {
printf("%d\n", hills[i]);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment