void solve() { for(int i=0;i<=n1;i++){ for(int j=0;j<=n2;j++){ if(i==0&&j==0){ dp[i][j]=0; } else if(i==0){ dp[i][j]=j; } else if(j==0){ dp[i][j]=i; } else{ dp[i][j]=_min_(dp[i-1][j-1]+same(i-1,j-1),_min_(dp[i-1][j]+1,dp[i][j-1]+1)); } } } }
void HTMLWidget::zoomIn( ) { m_zoomFactor = _min_( ZOOM_MAX_FACTOR, m_zoomFactor + m_zoomIncrement ); m_htmlPart->setZoomFactor( int( m_zoomFactor )); emit( optionsDirty( )); }
/******************************************************************************* Function : DDV_GetRulerForEditor() Purpose : create the ruler for the editor. This new descriptor is created using the descriptor of the viewer. Return value : an allocated data block ready for use by the editor. Null if failure *******************************************************************************/ NLM_EXTERN ValNodePtr DDV_GetRulerForEditor(ValNodePtr descr_head,Int4 from_disp, Int4 to_disp) { DDVRulerDescrPtr drdp,prev_drdp,new_drdp; ValNodePtr vnp2,vnp3,vnpDesc; Int4 cumulDecr,drdp_size,beginCopy,endCopy,drdp_start_ali; Boolean bPop; cumulDecr=0; vnpDesc=NULL; prev_drdp=NULL; for(vnp2=descr_head;vnp2!=NULL;vnp2=vnp2->next){ drdp=(DDVRulerDescrPtr)vnp2->data.ptrvalue; drdp_size=drdp->disp_stop-drdp->disp_start+1; /*not yet in the region of interest ?*/ if (drdp->disp_stop<from_disp) { cumulDecr+=drdp_size; continue; } beginCopy=_max_(from_disp,drdp->disp_start); endCopy=_min_(drdp->disp_stop,to_disp); if (drdp->bUnAligned==FALSE) drdp_start_ali=drdp->align_start+(beginCopy-drdp->disp_start); else drdp_start_ali=(Int4)-1; /*in order to merge nodes of same type, i keep track of the previous populated drdp node. Same style==yes, then just extend to the right the previous node*/ if (prev_drdp){ if (prev_drdp->bUnAligned==drdp->bUnAligned){ prev_drdp->disp_stop=endCopy; bPop=TRUE; } else{ bPop=FALSE; } } else{ bPop=FALSE; } if (!bPop){ new_drdp=(DDVRulerDescrPtr)MemNew(sizeof(DDVRulerDescr)); if (!new_drdp) goto erreur; new_drdp->disp_start=beginCopy; new_drdp->disp_stop=endCopy; new_drdp->align_start=drdp_start_ali; new_drdp->bUnAligned=drdp->bUnAligned; if (!vnpDesc){ vnp3=ValNodeAddPointer(&vnpDesc,0,(Pointer)new_drdp); } else{ vnp3=ValNodeAddPointer(&vnp3,0,(Pointer)new_drdp); } prev_drdp=new_drdp; } if (drdp->disp_stop>=to_disp) break; cumulDecr+=drdp_size; } return(vnpDesc); erreur: if (vnpDesc) ValNodeFreeData(vnpDesc); return(NULL); }