#include<iostream>
using namespace std;
int main(){
int state, prev = 1, tot = 0;
while(true){
cin >> state;
if(state == 0){
break;
}else if(state == 1){
tot += 1;
prev = 1;
}else{
if(prev == 1){
tot += 2;
prev = 2;
}else{
tot += prev + 2;
prev += 2;
}
}
}
cout << tot << endl;
return 0;
}
ccf csp 201803-1 跳一跳
猜你喜欢
转载自blog.csdn.net/lalala_HFUT/article/details/87191435
今日推荐
周排行