status_t CamSensor::AcceptVideoFrame(uint32 &width, uint32 &height) { // minimum sanity if (width < 1) width = MaxWidth(); if (height < 1) height = MaxHeight(); if (width > MaxWidth()) width = MaxWidth(); if (height > MaxHeight()) height = MaxHeight(); return B_OK; }
int MaxHeight(char str[]) { if(str[Index]=='l') { Index++; return 1; } Index++; int l,r; l = 1+MaxHeight(str); r = 1+MaxHeight(str); if(l>r) return l; else return r; }
int rConsole::Height(){ if (fullscreen) return MaxHeight(); else if (rSmallConsoleCallback::SmallColsole()) return sr_rows; else return height > sr_rows ? height : sr_rows; }
void MenuBar::updateLayout(void) { //Determine the Max Preferred Height of my MenuItems Real32 MaxHeight(0); Real32 TotalWidth(0); for(UInt32 i(0) ; i<getMFChildren()->size() ; ++i) { if(MaxHeight < getChildren(i)->getPreferredSize().y()) { MaxHeight = getChildren(i)->getPreferredSize().y(); } TotalWidth += getChildren(i)->getPreferredSize().x(); } //Set My preferred Size Pnt2f TopLeft, BottomRight; Pnt2f InsetsTopLeft, InsetsBottomRight; getBounds(TopLeft, BottomRight); getInsideInsetsBounds(InsetsTopLeft, InsetsBottomRight); Vec2f InsetSize( (BottomRight-TopLeft) - (InsetsBottomRight-InsetsTopLeft) ); Vec2f NewSize( TotalWidth+InsetSize.x(), MaxHeight+InsetSize.y()); if(getPreferredSize() != NewSize) { setPreferredSize(NewSize); } getInsideInsetsBounds(InsetsTopLeft, InsetsBottomRight); //Now position and size the Items Real32 LeftOffset(InsetsTopLeft.x()); Vec2f Size; Pnt2f Pos; for(UInt32 i(0) ; i<getMFChildren()->size() ; ++i) { Size.setValues(getChildren(i)->getPreferredSize().x(), MaxHeight); if(getChildren(i)->getSize() != Size) { getChildren(i)->setSize(Size); } Pos.setValues(LeftOffset, InsetsTopLeft.y()); if(getChildren(i)->getPosition() != Pos) { getChildren(i)->setPosition(Pos); } LeftOffset += getChildren(i)->getPreferredSize().x(); } }
int main() { int TC; scanf("%d",&TC); while(TC--) { char str[10050]; Index=0; scanf("%s",str); printf("%d\n",MaxHeight(str)-1); Index=0; } return 0; }