1 #include<stdio.h>
2 #include<stdlib.h>
3
4 struct node
5 {
6 int data;
7 struct node *next;
8 };
9
10 int main()
11 {
12 struct node *top,*p;
13 int x,y;
14 char c;
15 top=NULL;
16 while((c=getchar())!='#')
17 {
18 if(c>='0'&&c<='9')
19 {
20 p=(struct node*)malloc(sizeof(node));
21 p->data=c-'0';
22 p->next=top;
23 top=p;
24 }
25 else if(c=='+'||c=='-'||c=='*'||c=='/')
26 {
27 y=top->data;
28 top=top->next;
29 x=top->data;
30 if(c=='+')top->data=x+y;
31 else if(c=='-')top->data=x-y;
32 else if(c=='*')top->data=x*y;
33 else if(c=='/')top->data=x/y;
34 }
35 }printf("%d
",top->data);
36 return 0;
37 }