#include<stdio.h>
#include<stdlib.h>
#define STACK_INIT_SIZE 100
#define STACK_ADD 10
#define i 2
typedef struct
{
int *base;
int *top;
int stacksize;
}SqStack;
//栈的初始化
int InitStack(SqStack *S)
{
S->base = (int *)malloc(STACK_INIT_SIZE*sizeof(int));
if(!S->base)
return 0;
S->top=S->base;
S->stacksize=STACK_INIT_SIZE;
}
//入栈
int Push(SqStack *S,int e)
{
if(S->top-S->base >= S->stacksize)
{
S->base=(int *)realloc(S->base,(STACK_INIT_SIZE+STACK_ADD)*sizeof(int));
if(!S->base)
return 0;
S->top=S->base+S->stacksize;
S->stacksize +=STACK_ADD;
}
*S->top++ =e;
return 1;
}
//栈是否为空
int StackEmpty(SqStack *S)
{
if(S->top==S->base)
return 1;
else
return 0;
}
//出栈
int Pop(SqStack *S,int *e)
{
if(S->top==S->base)
return 0;
*e= *--S->top;
}
/*
int Pop(SqStack S,int *e)
{
if(S.top==S.base)
return 0;
*e= *--S->top;
}
*/
/*
void main()
{
int N;
int e;
SqStack S;
InitStack(&S);
scanf("%d",&N);
while(N)
{
Push(&S,N%2);
N=N/2;
}
while(!StackEmpty(&S))
{
Pop(&S,&e);
printf("%d",e);
}
}
*/
void main()
{
int N,e,m;
SqStack S;
InitStack(&S);
for(m=0;m<5;m++)
{
scanf("%d",&N);
while(N)
{
Push(&S,N%i);
N=N/i;
}
while(!StackEmpty(&S))
{
Pop(&S,&e);
printf("%d",e);
}
printf("\n");
}
}
#include<stdlib.h>
#define STACK_INIT_SIZE 100
#define STACK_ADD 10
#define i 2
typedef struct
{
int *base;
int *top;
int stacksize;
}SqStack;
//栈的初始化
int InitStack(SqStack *S)
{
S->base = (int *)malloc(STACK_INIT_SIZE*sizeof(int));
if(!S->base)
return 0;
S->top=S->base;
S->stacksize=STACK_INIT_SIZE;
}
//入栈
int Push(SqStack *S,int e)
{
if(S->top-S->base >= S->stacksize)
{
S->base=(int *)realloc(S->base,(STACK_INIT_SIZE+STACK_ADD)*sizeof(int));
if(!S->base)
return 0;
S->top=S->base+S->stacksize;
S->stacksize +=STACK_ADD;
}
*S->top++ =e;
return 1;
}
//栈是否为空
int StackEmpty(SqStack *S)
{
if(S->top==S->base)
return 1;
else
return 0;
}
//出栈
int Pop(SqStack *S,int *e)
{
if(S->top==S->base)
return 0;
*e= *--S->top;
}
/*
int Pop(SqStack S,int *e)
{
if(S.top==S.base)
return 0;
*e= *--S->top;
}
*/
/*
void main()
{
int N;
int e;
SqStack S;
InitStack(&S);
scanf("%d",&N);
while(N)
{
Push(&S,N%2);
N=N/2;
}
while(!StackEmpty(&S))
{
Pop(&S,&e);
printf("%d",e);
}
}
*/
void main()
{
int N,e,m;
SqStack S;
InitStack(&S);
for(m=0;m<5;m++)
{
scanf("%d",&N);
while(N)
{
Push(&S,N%i);
N=N/i;
}
while(!StackEmpty(&S))
{
Pop(&S,&e);
printf("%d",e);
}
printf("\n");
}
}