[ABC033C] 数式の書き換え 题解
一道简单的计数题。很显然,由于题目的特殊条件,想让最终的和为
因为只包含加号和乘号,而一个数乘以
放代码:
#include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
string s; int c=0,x=1; cin>>s;
for(char i:s)
switch(i){
case '+':c+=x,x=1; break;
case '0':x=0;
}
cout<<c+x<<endl;
return 0;
}