• 个人简介

    嘿嘿

    #include <bits/stdc++.h>
    #define aa stack
    #define bb long long
    #define cc string
    #define dd using
    #define ee namespace
    #define ff std
    #define gg main
    #define hh int
    #define ii cin>>
    #define jj for
    #define kk cout<<
    #define ll length
    #define mm if
    #define nn switch
    #define oo push
    #define pp case
    #define qq pop
    #define rr top
    #define ss break
    dd ee ff;
    aa<hh> s;
    hh gg()
    {
        cc c;
        ii c;
        jj(hh i=c.ll()-1;i>=0;i--){
            mm(c[i]>='0'&&c[i]<='9'){
                s.oo(c[i]-'0');
            }
            hh x,y;
            nn(c[i]){
                pp '+':
                    x=s.rr();
                    s.qq();
                    y=s.rr();
                    s.qq();
                    s.oo(x+y);
                    ss;
                pp '-':
                    x=s.rr();
                    s.qq();
                    y=s.rr();
                    s.qq();
                    s.oo(x-y);
                    ss;
                pp '*':
                    x=s.rr();
                    s.qq();
                    y=s.rr();
                    s.qq();
                    s.oo(x*y);
                    ss;
                pp '/':
                    x=s.rr();
                    s.qq();
                    y=s.rr();
                    s.qq();
                    s.oo(x/y);
                    ss;
                
            }
        }
        kk s.rr();
    }
    

    【挑战题】前缀表达式求值

    完全看不懂吧!

    Page Views Count

  • 最近活动

    This person is lazy and didn't join any contests or homework.
  • 最近编写的题解

    This person is lazy and didn't write any solutions.