top of page

소스 코드 제출

공개·회원 77명

20260305

/*

#include <stdio.h>

int stack[201]={};

int ttop=-1;


void push(int a)

{

ttop++;

stack[ttop] = a;

}


void pop()

{

if(ttop > -1) ttop--;

}


void top()

{

if(ttop == -1)

{

printf("-1\n");

}

else

{

printf("%d\n", stack[ttop]);

}

}


void size()

{

printf("%d\n", ttop+1);

}


void empty()

{

if(ttop == -1)

{

printf("true\n");

}

else

{

printf("false\n");

}

}


int main()

{

int n;

char c[20]={};

scanf("%d", &n);

getchar();


for(int i=0; i<n; i++)

{

gets(c);

int x = 0;

if(c[0]=='p' && c[1]=='u')

{

for(int j=6; c[j]!=' '; j++)

{

x = x * 10 + (c[j] - '0');

}

push(x);

}

else if(c[0]=='p')

{

pop();

}

else if(c[0]=='t')

{

top();

}

else if(c[0]=='s')

{

size();

}

else

{

empty();

}

}


return 0;

}

*/

/*

#include <stdio.h>

int queue[201] = {};

int ffront = -1;

int bback = -1;


void push(int a)

{

bback++;

queue[bback] = a;

}


void pop()

{

if(bback - ffront != 0) ffront++;

}


void front()

{

if(bback - ffront != 0) printf("%d\n", queue[ffront+1]);

else printf("-1\n");

}


void back()

{

if(bback - ffront != 0) printf("%d\n", queue[bback]);

else printf("-1\n");

}


void size()

{

printf("%d\n", bback - ffront);

}


void empty()

{

if(bback - ffront == 0)

{

printf("true\n");

}

else

{

printf("false\n");

}

}


int main()

{

int n;

char c[20] = {};

scanf("%d", &n);

getchar();


for(int i=0; i<n; i++)

{

gets(c);

int x = 0;

if(c[0]=='p' && c[1]=='u')

{

for(int j=6; c[j]!=' '; j++)

{

x = x * 10 + (c[j] - '0');

}

push(x);

}

else if(c[0]=='p')

{

pop();

}

else if(c[0]=='f')

{

front();

}

else if(c[0]=='b')

{

back();

}

else if(c[0]=='s')

{

size();

}

else if(c[0]=='e')

{

empty();

}

}

return 0;

}

*/


#include <stdio.h>

#include <stdlib.h>


typedef struct NODE

{

int data;

struct NODE *next;

}node;


node* make_node(int d)

{

node *tmp = (node*)malloc(sizeof(node));

tmp->data = d;

tmp->next = NULL;

return tmp;

}


node* make_head()

{

node *tmp = (node*)malloc(sizeof(node));

tmp->next = NULL;

return tmp;

}


void push(int a)

{

node* new_node = make_node(a);

new_node->next =

}


void pop()

{

}


void top()

{

}


void size()

{

}


void empty()

{

}


int main()

{

int n;

char c[20] = {};

scanf("%d", &n);

getchar();

for(int i=0; i<n; i++)

{

gets(c);

int x = 0;

if(c[0]=='p' && c[1]=='u')

{

for(int j=6; c[j]!=' '; j++)

{

x = x * 10 + (c[j] - '0');

}

push(x);

}

else if(c[0]=='p')

{

pop();

}

else if(c[0]=='t')

{

top();

}

else if(c[0]=='s')

{

size();

}

else if(c[0]=='e')

{

empty();

}

}

return 0;

}

10회 조회
주소 : 경기도 용인시 광교중앙로 302 블루 스퀘어 602호
연락처 : 031) 216 - 1546 ,     031) 215 - 1546
사업자등록번호 : 465-92-00916
​학원 등록 제 4603호
bottom of page