fork download
  1. #include <stdio.h>
  2. #include <math.h>
  3. #include <stdint.h>
  4. typedef unsigned long long int ull;
  5.  
  6. ull cmp(const void * a, const void * b) { return *(ull *)a - *(ull *)b; }
  7.  
  8. int main() {
  9. int i = 0, a, b;
  10. int A = 17,
  11. B = 16;
  12. int MAX = A * B;
  13. ull z[MAX];
  14. for (b = 0; b < B; ++b) {
  15. for (a = 0; a < A; ++a) {
  16. if (i >= MAX) break;
  17. z[i++] = pow(2, a) * pow(3, b);
  18. }
  19. }
  20. qsort(z, MAX, sizeof(ull), cmp);
  21. printf("{ ");
  22. for (i = 0; i < 100; ++i)
  23. printf("%lld%c ", z[i], i < 99 ? ',' : 0);
  24. printf("}");
  25. return 0;
  26. }
Success #stdin #stdout 0s 2184KB
stdin
Standard input is empty
stdout
{ 1, 2, 3, 4, 6, 8, 9, 12, 16, 18, 24, 27, 32, 36, 48, 54, 64, 72, 81, 96, 108, 128, 144, 162, 192, 216, 243, 256, 288, 324, 384, 432, 486, 512, 576, 648, 729, 768, 864, 972, 1024, 1152, 1296, 1458, 1536, 1728, 1944, 2048, 2187, 2304, 2592, 2916, 3072, 3456, 3888, 4096, 4374, 4608, 5184, 5832, 6144, 6561, 6912, 7776, 8192, 8748, 9216, 10368, 11664, 12288, 13122, 13824, 15552, 16384, 17496, 18432, 19683, 20736, 23328, 24576, 26244, 27648, 31104, 32768, 34992, 36864, 39366, 41472, 46656, 49152, 52488, 55296, 59049, 62208, 65536, 69984, 73728, 78732, 82944, 93312 }