Скачиваний:
37
Добавлен:
10.02.2019
Размер:
595 б
Скачать
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define N 1000

int compare(const void * x1, const void * x2){                           
  return ( *(int*)x2 - *(int*)x1 );                                          
}

int main() {
    int arr[N];
    long int time1;
    long int time2;
    
    for(int i = 0; i<N; i++){
        scanf("%d",&arr[i]);
    }
   time1 = clock();
   qsort (arr, N, sizeof(int), compare);
   time2 = clock();
   
   for(int i =0; i<N; i++){
     printf("%d ",arr[i]);
   }
   
   printf("\n%d",time2-time1);
   
   return 0;
}
Соседние файлы в папке lab1