#include <stdio.h>
#define SIZE 10
double stack[SIZE];
int sp;
void push(double value);
double pop(void);
int isFull(void);
int isEmpty(void);
void answer(void);
void reset(void);
int main(void)
{
reset();
int resp;
double num1,num2,value;
while(1)
{
if(resp==9) break;
switch(resp)
{
case 5:
push(value);
break;
case 1:
num1=pop();
num2=pop();
push(num1+num2);
break;
case 2:
num1=pop();
num2=pop();
push(num2-num1);
break;
case 3:
num1=pop();
num2=pop();
push(num2*num1);
break;
case 4:
num1=pop();
num2=pop();
push(num2/num1);
break;
}
}
answer();
return 0;
}
void push(double value)
{
if(isFull())
else
stack[sp++]=value;
}
double pop(void)
{
if(isEmpty()){
else {
return stack[--sp];}
}
int isFull(void)
{
return sp==SIZE;
}
int isEmpty(void)
{return sp==0;
}
void answer(void)
{
printf("answer:%f",stack
[sp
-1]); }
void reset(void)
{
sp=0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgojZGVmaW5lIFNJWkUgMTAKZG91YmxlIHN0YWNrW1NJWkVdOwppbnQgc3A7Cgp2b2lkIHB1c2goZG91YmxlIHZhbHVlKTsKZG91YmxlIHBvcCh2b2lkKTsKaW50IGlzRnVsbCh2b2lkKTsKaW50IGlzRW1wdHkodm9pZCk7CnZvaWQgYW5zd2VyKHZvaWQpOwp2b2lkIHJlc2V0KHZvaWQpOwoKaW50IG1haW4odm9pZCkKewogICAgcmVzZXQoKTsKICAgIGludCByZXNwOwogICAgZG91YmxlIG51bTEsbnVtMix2YWx1ZTsKICAgIHdoaWxlKDEpCiAgICB7CiAgICBzY2FuZigiJWQiLCZyZXNwKTsKICAgIGlmKHJlc3A9PTkpIGJyZWFrOwogICAgc3dpdGNoKHJlc3ApCnsKICAgICAgY2FzZSA1OgogICAgc2NhbmYoIiVsZiIsJnZhbHVlKTsKICAgIHB1c2godmFsdWUpOwogICAgYnJlYWs7CiAgICBjYXNlIDE6CiAgICBudW0xPXBvcCgpOwogICAgbnVtMj1wb3AoKTsKICAgIHB1c2gobnVtMStudW0yKTsKICA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