求助!明明答案对的却总是WA

P1449 后缀表达式

__Chtholly @ 2020-11-02 21:21:27

RT 我的评测记录


by __Chtholly @ 2020-11-02 21:22:24

现在加了个'/'判断然后RE了


by __Chtholly @ 2020-11-02 21:24:31

我下载了第一个测试点

3.5.2.-*7.+@

接着我又到我的机子上测了遍

结果是16

但答案结果也是16,最终它给我判错

求助!


by y0y68 @ 2020-11-02 21:34:59

@Hachieve 小花你个评测记录是故意的吗?


by __Chtholly @ 2020-11-02 21:35:51

@y0y68 ?qwq我没啥意思啊,就是讲我炸了qwq


by y0y68 @ 2020-11-02 21:37:09

@Hachieve 评测记录是给你自己看的吗?


by __Chtholly @ 2020-11-02 21:39:19

@y0y68 ???阿这。。那当我没发过(qwq)

还有_rqy帮我看看我到底是哪里错的啊qwq


by zxw666 @ 2020-11-02 21:39:24

小花,你看这


by __Chtholly @ 2020-11-02 21:39:45

#include<cstdio>
int len,len2;
int num;
char ch[1005];
int stack2[10000005];
int main()
{
    while(ch[++len]=getchar())
    {
        if(ch[len]=='@'){len--;break;}
        if(ch[len]>='0'&&ch[len]<='9')
            num=num*10+ch[len]-'0';
        else if(ch[len]=='.')
                stack2[++len2]=num,num=0;
        else if(ch[len]!='@')
        {
            if(ch[len]=='-')
                stack2[--len2]=stack2[len2]-stack2[len2+1]; 
            if(ch[len]=='+')
                stack2[--len2]=stack2[len2]+stack2[len2+1]; 
            if(ch[len]=='*')
                stack2[--len2]=stack2[len2]*stack2[len2+1];
            if(ch[len]=='/')
                stack2[--len2]=stack2[len2]/stack2[len2+1];
        }
    }
    printf("%d",stack2[1]);
    return 0;
}

by __Chtholly @ 2020-11-02 21:40:23

抱歉哈刚才应该啥都看不到,现在我把代码放出来了qwq


by __Chtholly @ 2020-11-02 21:41:14

@killer柒 危


| 下一页