asdfo123 @ 2020-09-27 13:33:17
不开
开
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int maxn = 1010;
char c[maxn];
int st[maxn];
bool comp(char *c)
{
int i = 0;
int now = 0;
int top = 0;
while(c[i]!='@')
{
if(c[i]>='0' && c[i]<='9')
{
now*=10;
now+=c[i] - '0';
}
else if(c[i] == '.')
{
st[++top] = now;
now = 0;
}
else if(c[i] == '+')
{
st[top-1] = st[top-1] + st[top];
st[top] = 0;
top--;
}
else if(c[i] == '-')
{
st[top-1] = st[top-1] - st[top];
st[top] = 0;
top--;
}
else if(c[i] == '*')
{
st[top-1] = st[top-1] * st[top];
st[top] = 0;
top--;
}
else if(c[i] == '/')
{
st[top-1] = st[top-1] / st[top];
st[top] = 0;
top--;
}
i++;
}
}
signed main()
{
scanf("%s",c);
comp(c);
printf("%lld\n",st[1]);
return 0;
}
by 忘怀星 @ 2020-09-27 13:34:44
盲猜未定义
by Re_Fable @ 2020-09-27 13:34:53
因为爱情~
by liuziwen0224 @ 2020-09-27 13:35:41
前排滋滋
lxy ak ioi
by 忘怀星 @ 2020-09-27 13:36:05
建议看一下SF的博客
by Rui_R @ 2020-09-27 13:36:05
@asdfo123 comp没有返回值
by asdfo123 @ 2020-09-27 13:36:56
@Rui_R 谢谢!
by fisheep @ 2020-09-27 13:42:59
为啥被删了?????
by Re_Fable @ 2020-09-27 13:43:56
signed main()
和
int main()
有什么区别?
by fisheep @ 2020-09-27 13:44:15
by 忘怀星 @ 2020-09-27 13:44:18
@Luo_Feng signed其实是signed int好像