首页>计算机>软件水平考试>历年真题>正文
2001年高级程序员级下午试题含答案

www.zige365.com 2010-7-10 11:04:41 点击:发送给好友 和学友门交流一下 收藏到我的会员中心
回溯*/

{ int c = 4 ;

    while ( c == 4 ){

        if ( *ip <= 0 ) return 0 ;

        --(*ip) ;

        c = __(1)__ ;

        color[*ip] = -1 ;

    } 

    return c ;

}

/*检查区域i,c种颜色的可用性*/

int color0k( int i , int c , int[][N] , int color[ ] }

{ int j ;

    for ( j = 0 ; j < i ; j++ }

        if ( __(2)__ )

            return 0 ;

    return 1 ;

}

 

/*为区域i选一种可着的颜色*/

int select( int i ,int c ,int adj[][N] , int color[ ] )

{ int k ;

    for ( k = c ; k <= 4 ; k++ )

        if ( colorOK( __(2)__ ) )

            return k ;

        return 0 ;

}

int coloring( int adj[][N] ) /*寻找各种着色方案*/

{ int color[N] , i , c , cnt ;

    for ( i = 0 ; i < N ; i++ ) color[i] = -1 ;

    i = c = 0 ; cnt = 0 ;

    while ( 1 ) {

        if ( ( c = __(4)__ ) == 0 ){

            c = back( &i , color) ;

            if ( c == 0) return cnt ;

        } else { __(5)__ ; i++ ;

            if ( i == N ) {

                    output(color) ;

                    ++cnt ;

                    c = back( &i , color ) ;

                  } e1se c = 0 ;

                }

        }

}

void main()

{ int adj[N][N] = 

            { {0,1,0,1,1,1,1,1,1,1},

              {1,0,1,1,0,1,1,1,1,0},

              {0,1,0,1,0,1,1,0,1,1},

              {1,1,1,0,1,1,0,0,1,1},

              {1,0,0,1,0,1,0,0,0,0},

              {1,1,1,1,1,0,1,0,0,1},

本新闻共5页,当前在第4页  1  2  3  4  5  

我要投稿 新闻来源: 编辑: 作者:
相关新闻