#include #include typedef struct _cell { int element; struct _cell *next; } cell; typedef struct _list { cell *head; } list; list* create() { list *L = (list *)malloc(sizeof(list)); L->head = (cell *)malloc(sizeof(cell)); L->head->next = NULL; L->head->element = -1; return L; } void addFirst(list *L, int element) { cell *add = (cell *)malloc(sizeof(cell)); add->element = element; add->next = L->head->next; L->head->next = add; } void sort(list *L) { cell *t = L->head->next; if(t == NULL) return; //データが無い while(t->next != NULL) { //ソートした最大値と比較 if(t->element <= t->next->element) { //移動の必要無し t = t->next; continue; } //挿入位置を探す(必ずある) cell *p = L->head; for(; t->next->element > p->next->element; p=p->next); cell *next = t->next->next; //挿入 t->next->next = p->next; p->next = t->next; //移動させたcellに繋がっていた元のポインタを付け替え t->next = next; } } int main(void){ // 大きい箱 int bigbox = 0; scanf("%d", &bigbox); int len = 0; scanf("%d", &len); int val[len]; for(int i = 0;i < len;i++){ scanf("%d",val[i]); printf("%d",val[i]); } }