From 1249a9c0f7ef4845594ca97d23933c5915e42af4 Mon Sep 17 00:00:00 2001 From: SAM <73647831+samhackathon@users.noreply.github.com> Date: Tue, 31 Oct 2023 13:16:21 +0500 Subject: [PATCH] Delete Add Code Here/uri 1011.c --- Add Code Here/uri 1011.c | 70 ---------------------------------------- 1 file changed, 70 deletions(-) delete mode 100644 Add Code Here/uri 1011.c diff --git a/Add Code Here/uri 1011.c b/Add Code Here/uri 1011.c deleted file mode 100644 index 3ef58998d9c..00000000000 --- a/Add Code Here/uri 1011.c +++ /dev/null @@ -1,70 +0,0 @@ -#include -#include -#include -#include -#include - -struct Cartas { char carta; - struct Cartas *prox; -}; -typedef struct Cartas TCartas; - -struct descrPilha { - TCartas *topo, *final; - int qtd; -}; -typedef struct descrPilha DPilha; - -int main(){ - int vDescart[55], Cqtd, c=0, k=0; - DPilha descritor; - TCartas *aux; - - while (scanf("%d", &Cqtd) && Cqtd != 0){ - for(c=0; c < 55; c++) - vDescart[c] = 0; - - k = 0; - - descritor.topo = NULL; - descritor.qtd = 0; - - for(c=Cqtd; c > 0; c--){ - aux = (TCartas *) malloc(sizeof(TCartas)); - - if(aux == NULL) - break; - - aux->carta = c; - aux->prox = descritor.topo; - - descritor.topo = aux; - descritor.qtd++; - - if(c == Cqtd) - descritor.final = aux; - } - - while (descritor.qtd >= 2){ - aux = descritor.topo; - descritor.topo = aux->prox; - vDescart[k] = aux->carta; - free(aux); - descritor.qtd--; - k++; - aux = descritor.topo->prox; - descritor.final->prox = descritor.topo; - descritor.final = descritor.topo; - descritor.topo = aux; - } - - printf("Discarded cards:"); - for(c=0; c < k; c++){ - printf(" %d", vDescart[c]); - if(c != k-1) - printf(","); - } - printf("\nRemaining card: %d\n", descritor.final->carta); - } - return 0; -}