模拟,按题意模拟即可
#include<iostream>
using namespace std;
int main(){
int x,res=0,score=0,last=0;
while(cin>>x&&x){
if(x==1){
score=1;
res+=score;
}
else{
if(last==1)score=2;
else score=score+2;
res+=score;
}
last=x;
}
cout<<res<<endl;
return 0;
}