| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- typedef int Info_t;
- typedef struct node {
- Info_t Info;
- struct node *next;
- } Node;
- typedef struct head {
- Node first;
- Node last;
- } Head;
- void permute (int i, int n, char str[]);
- int main ( int argc , char ** argv ){
- int n = 50;
- int * sequence = calloc(n, sizeof(int));
- sequence[0] = n / 1.3;
- printf("%d ", sequence[0]);
- int i = 1;
- while(sequence[i - 1] > 1){
- sequence[i] = sequence[i - 1] / 1.3;
- if(sequence[i] == 9 || sequence[i] == 10){
- sequence[i] = 11;
- }
- printf("%d ", sequence[i]);
- i++;
- }
- printf("%d ", sequence[i + 1]);
- return EXIT_SUCCESS;
- }
- void swap (char *x, char *y){
- char temp;
- temp = *x;
- *x = *y;
- *y = temp;
- }
- void permute (int i, int n, char str[]){
- int j;
- int k;
- if (i == n){
- printf("%s\n", str);
- } else {
- for (j = i; j <= n; j++){
- swap(&str[i], &str[j]);
- permute(i + 1, n, str);
- swap(&str[i], &str[j]);
- }
- }
- }
|