#include<bits/stdc++.h>
using namespace std;
string s;
int st,ss[100000000];
void zs(int k){
int x=0;
int t = 1;
for(int i = k;i>=0;i--){
x+=(s[i]-'0')*t;
t*=2;
}
st=x;
}
void f(int x){
int ans=0;
while (x){
ss[++ans]=x%2;
x/=2;
}
for (int i=ans;i>=1;i--)cout<<ss[i];
}
int main(){
int a,b;
cin>>a>>b>>s;
zs(s.size()-1);
while (b--){
char vv;
cin>>vv;
if (vv=='*')st*=2;
else if (vv=='/')st/=2;
else if (vv=='+')st+=1;
else if (vv=='-')st-=1;
}
f(st);
return 0;
}
求助,上次一个大佬挑出一个错,可改了以后还不对,谁来看看。
全错