/*
#include<stdio.h>
char stack [300]= {};
int top=-1;
void push (char data)
{
top++;
stack [top]=data;
}
char pop()
{
if(top!=-1)
return stack[top--];
}
int main()
{
int n,i,c=0;
char str[201];
scanf ("%d %s",&n,str);
for (i=n-1; i>=0; i--)
{
push(str[i]);
c++;
if(c%3==0 && i!=0)
{
push(',');
}
}
while(top!=-1)
{
printf("%c",pop());
}
return 0;
}
#include<stdio.h>
char stack [50001]= {};
int top=-1;
void push (char data)
{
top++;
stack [top]=data;
}
int main()
{
int n,i,c=0;
char str[50001];
scanf("%s",str);
for (i=0;str[i]!=NULL;i++)
{
if(str[i]=='(')
{
top++;
}
else
{
if (top==-1)
{
printf("bad");
return 0;
}
else
{
top--;
}
}
}
if(top==-1)
{
printf("good");
}
else
{
printf("bad");
}
return 0;
}
#include<stdio.h>
int stack [32768]= {};
int top=-1;
void push (int data)
{
top++;
stack [top]=data;
}
int pop()
{
if(top!=-1)
return stack[top--];
}
int main()
{
int n,t,i;
scanf ("%d",&n);
t=n;
////////////////
printf("2 ");
if (n==0)
{
printf("0");
}
for(;n>0;)
{
push(n%2);
n=n/2;
}
while(top!=-1)
printf("%d",pop());
printf("\n");
/////////////////
n=t;
printf("8 ");
if (n==0)
{
printf("0");
}
for(;n>0;)
{
push(n%8);
n=n/8 ;
}
while(top!=-1)
printf("%d",pop());
printf("\n");
////////////// 16 Áø¼ö : 10 ~ 15 'A' ~ 'F'
n=t;
printf("16 ");
if (n==0)
{
printf("0");
}
for(;n>0;)
{
push(n%16);
n=n/16 ;
}
while(top!=-1)
{
int x = pop();
if(x<10) printf("%d",x);
else printf("%c",x+55);
}
}
#include<stdio.h>
#include<string.h>
int top=0;
int main()
{
char str[100001]={};
int i, sum=0;
scanf("%s",str);
for(i=0;str[i]!=NULL;i++)
{
if(str[i]=='(')
{
if (str[i+1]==')')
{
sum+=top;
}
else
{
top++;
}
}
else if(str[i-1]!='(')
{
sum++;
top--;
}
}
printf("%d",sum);
return 0;
}
*/
#include <stdio.h>
#include <Windows.h>
//
//int stack[10000]={};
//int top=-1; //top : 마지막으로 들어온 데이터의 위치
//
//void push(int data)
//{
// top++;
// stack[top]=data;
//}
//
//int pop()
//{
// return stack[top--];
//}
int queue[1000]={};
int rear=-1; // 꼬리 - 마지막으로 들어온 데이터의 위치 (top)
int front=-1; // 머리 - 마지막으로 나간 데이터의 위치
void enqueue(int data)
{
rear++;
queue[rear]=data;
}
int dequeue()
{
front++;
return queue[front];
}
int main()
{
int a, b, c;
while(1)
{
printf("1.enq 2.deq >>");
scanf("%d",&a);
if(a==1){
printf("input data>>");
scanf("%d",&b);
enqueue(b);
printf("success enqueue\n");
}
else if(a==2) //deq부분 만들기
{
}
}
/*//printf("큐에 데이터를 입력하는 중입니다\n");
printf("start enq...\n");
enqueue(10);
Sleep(1000);
enqueue(9);
Sleep(1000);
enqueue(8);
Sleep(1000);
printf("end enqueue\n");
//printf("큐에 데이터를 전부 넣었습니다.\n");
Sleep(1500);
printf("we will start dequeue()\n");
//printf("이제 큐에서 데이터를 전부 빼겠습니다.\n");
Sleep(1000);
while(front!=rear) //큐가 비어있지 않을동안
{
printf("%d ",dequeue());
Sleep(500);
}
printf("\nend dequeue\n");
*/
}



