#include <stdio.h> #include <stdlib.h> void print_ary(int *a, size_t sz) { int i; } void q_sort(int *a, int left, int right) { int i = left, j = right, key = a[(left + right) / 2]; if(left >= right) return; // printf("i(%d,%d) ", left, right); print_ary(a, 5); printf("\n"); while(1){ for( ; i <= j; ++i) if(a[i] >= key) break; for( ; j >= i; --j) if(a[j] <= key) break; if(i >= j) break; else{ int t = a[j]; a[j] = a[i]; a[i] = t; ++i; --j; } } if(right <= left + 1) return; if(i > left) q_sort(a, left, i); if(right > j) q_sort(a, j, right); // printf("o(%d,%d) ", left, right); print_ary(a, 5); printf("\n"); } int fact(int n) { if(n <= 1) return 1; return n * fact(n - 1); } int ipow(int x, int y) { int n, r = x; if(!y) return 1; for(n = 1; n < y; ++n) r *= x; return r; } void perm(int *a, int sz, int m) { int n, p; if(!b) return; for(n = 0; n < (sz - 1); ++n){ int o = n + 2; b[n] = (n ? p : m) % o; p = (n ? p : m) / o; } for(n = 0; n < sz; ++n) a[n] = sz - n; for(n = 0; n < (sz - 1); ++n){ int q = b[sz - 2 - n]; int r = a[n + q]; for( ; q > 0; --q) a[n + q] = a[n + q - 1]; a[n] = r; } } void combi(int *a, int sz, int m) { int n; for(n = 0; n < sz; ++n){ volatile int o = m / ipow(sz, n); a[n] = o % sz + 1; } } int main(int ac, char **av) { int ary[6]; int l, m, n, o = 0; for(l = 5; l <= 6; ++l){ #if(1) // OK for(m = 0; m < fact(l); ++m){ perm(ary, l, m); #else // BAD for(m = 0; m < ipow(l, l); ++m){ combi(ary, l, m); #endif q_sort(ary, 0, l - 1); for(n = 1; n < l; ++n) if(ary[n] < ary[n - 1]){ n = 0; ++o; break; } } } return 0; }
Standard input is empty
5 4 3 2 1 -> 1 2 3 4 5 -> OK 5 4 3 1 2 -> 1 2 3 4 5 -> OK 5 4 2 3 1 -> 1 2 3 4 5 -> OK 5 4 2 1 3 -> 1 2 3 4 5 -> OK 5 4 1 3 2 -> 1 2 3 4 5 -> OK 5 4 1 2 3 -> 1 2 3 4 5 ->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