abaowu 发表于 2011-06-17 16:16

天才的排序算法...



#include <stdio.h>
#include <stdlib.h>
#include <omp.h>

int main(int argc, char **argv) {
int i;

omp_set_num_threads(argc);

#pragma omp parallel for
for (i = 0; i < argc - 1; i++) {
    long int this = atol(argv);

    sleep(this);

    printf("%ld\n", this);
    fflush(stdout);
}

return 0;
}
原地址:http://dis.4chan.org/read/prog/1295544154
:D有意思啊,用sleep来排序

kiqq2003 发表于 2011-06-21 17:11

哈哈,果真天才。。。。。。:luya:

x9x9 发表于 2011-06-21 17:37

不懂 C++ 的路过,质疑其效率会不会慢?

kiqq2003 发表于 2011-06-21 18:38

回复 3# x9x9


    没看原文么, 如果 对0 和 21888 进行排序,需要等待的时间是 21888 秒 。:emn10:
页: [1]
查看完整版本: 天才的排序算法...