KakaoTalk_20190606_001802318.png
  • 246x0w
Welcome
Curriculum
Install&Go
Board
실제 작동 상태를 확인하려면 라이브 사이트로 이동하세요.
  • 카테고리
  • 전체 게시물
  • 내 게시물
양재영
2020년 5월 17일

200517

게시판: 소스 코드 제출

#include<stdio.h>

#include<string.h>

#define size 100


int stack[size];

int top;

int stack2[size];

int top2;

int stack3[size];

int top3;


void init()

{

top = -1;

top2 = -1;

top3 = -1;

}


int push(int a)

{

top++;

stack[top]=a;

}

int push2(int b)

{

top2++;

stack2[top2]=b;

}

int push3(int b)

{

top3++;

stack3[top3]=b;

}

int pop()

{

if(top==-1)

{

return 0;

}

return stack[top--];

}

int pop2()

{

if(top2==-1)

{

return 0;

}

return stack2[top2--];

}

int pop3()

{

if(top3==-1)

{

return 0;

}

return stack3[top3--];

}

int main()

{

char a[100], b[100], c[100], d[100];


int i, j, h, hh = 0, m, n, k, e = 0;


scanf("%s %s", a, b);


init();


for(i=0; i<strlen(a); i++)

{

push(a[i]-'0');

}


for(i=0; i<strlen(b); i++)

{

push2(b[i]-'0');

}

//여기고치기!!숙제!!

for(i=0; i<strlen(a) ; i++)

{

m = pop();

n = pop2();


n += hh;

hh = 0;

if(9<m+n)

{

h = m+n;

hh =(m+n)/10;

h =(m+n)%10;

push3(h);

}

else

{

h = n + m;

push3(h);

}

}

e = top3;

for(i=0; i<=e; i++)

{

printf("%d",pop3());

}


return 0;

}









댓글 0개
0
댓글
댓글 0개
유사 게시물
  • 200517
  • 200517
  • 200517
주소 : 경기도 용인시 광교중앙로 302 블루 스퀘어 602호
연락처 : 031) 216 - 1546
사업자등록번호 : 465-92-00916
​학원 등록 제 4603호