phi_gros @ 2024-10-28 21:22:11
#include<bits/stdc++.h>
using namespace std;
int zh(string a){
int as = a.size();
int ans;
for(int i = 0;i < as;i ++){
ans += int(a[i] + ans * 10);
}
return ans;
}
string zhh(int a){
string aa;
while(a){
int x = a % 10;
aa += char(x + '0');
a /= 10;
}
return aa;
}
int zjsy(string aa,string bb,char c){
int a,b;
a = zh(aa);
b = zh(bb);
if(c == '+')return a + b;
if(c == '-')return a - b;
if(c == '*')return a * b;
else return a / b;
}
int main(){
string a;
stack <string> s;
cin >> a;
int as = a.size();
string aaa;
for(int i = 0;i < as;i ++){
if(a[i] - '0' >= 0 && a[i] - '0' <= 9)aaa += a[i];
else if(a[i] == '.'){
s.push(aaa);
aaa = "";
}
else {
string x,y;
x = s.top();
s.pop();
y = s.top();
s.pop();
s.push(zhh(zjsy(x,y,a[i])));
if(a[i] == '@'){cout << zjsy(x,y,a[i]);return 0;}
}
}
return 0;
}
全RE,写的什么东西我自己都看不懂了
by AKIOI_GO @ 2024-11-05 19:39:42
你有想过负数吗?