简单
codeclass StockSpanner {
public:
vector<int> v;
vector<int> vv;
StockSpanner() {
//vector<int> v;
}
int next(int price) {
v.push_back(price);
int cnt = 1;
for(int i=v.size()-2; i>=0; i-=vv[i]) {
if(i >=0 && v[i]<=v[v.size() - 1]) {
cnt+=vv[i];
}else{
break;
}
}
vv.push_back(cnt);
return cnt;
}
};