• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            我希望你是我獨家記憶

            一段永遠封存的記憶,隨風而去
            posts - 263, comments - 31, trackbacks - 0, articles - 3
               :: 首頁 :: 新隨筆 ::  :: 聚合  :: 管理

            URAL——1015——(立體旋轉)

            Posted on 2008-08-16 01:51 Hero 閱讀(150) 評論(0)  編輯 收藏 引用 所屬分類: 代碼如詩--ACM

             

            /*
            ID: wangzha4
            LANG: C++
            JUDGE_ID: 65448BI
            */
            //輸出沒看清楚WA好長時間
            //屬于立體旋轉問題

            #include 
            <stdio.h>
            #include 
            <stdlib.h>
            #include 
            <string.h>
            #include 
            <ctype.h>
            #include 
            <math.h>
            #define unllong unsigned long long 
            #define unint unsigned int
            #define printline  printf( "\n" ) 
            typedef 
            long long llong ;
            const double PI = 2.0 * acos( 0.0 ) ;

            const int Base=1000000000;
            const int Capacity=100;
            const int INF = 1000000 ;
            const int size = 100010 ;

            struct DICE
            {
                
            //char node[7] ;
                int num ;
                
            int val ;
            };
            struct DICE dice[size] ;

            struct OUT
            {
                
            short num[size] ;
                
            int len ;
            };
            struct OUT out[730] ;
            int ct_out = 0 ;

            int node[7] ;
            int inn ;

            void changeline( int posi, int x )
            {
                
            forint k=1; k<=4; k++ )
                {
                    
            if( x == node[posi] )    return ;
                    node[
            0= node[1] ; node[1= node[6] ;
                    node[
            6= node[2] ; node[2= node[4] ;
                    node[
            4= node[0] ; 
                }
            }

            void changerow( int posi, int x )
            {
                
            forint k=1; k<=4; k++ )
                {
                    
            if( x == node[posi] )    return ;
                    node[
            0= node[1] ; node[1= node[3] ;
                    node[
            3= node[2] ; node[2= node[5] ;
                    node[
            5= node[0] ; 
                }
            }

            void changetop( int posi, int x )
            {
                
            forint k=1; k<=4; k++ )
                {
                    
            if( x == node[posi] )    return ;
                    node[
            0= node[4] ; node[4= node[3] ;
                    node[
            3= node[6] ; node[6= node[5] ;
                    node[
            5= node[0] ;
                }
            }

            void input()
            {
                
            forint i=1; i<=inn; i++ )
                {
                    
            //printf( "i == %d\n", i ) ;
                    forint k=1; k<=6; k++ ) scanf( "%d"&node[k] ) ;

                    
            while( node[1!= 1 ) 
                    {
                        changeline( 
            11 ) ;
                        
            if1 == node[1] )    break ;
                        changerow ( 
            11 ) ;
                    }
                    
            if2 == node[2] )
                    {
                        
            while( node[3!= 3 ) changetop( 33 ) ;
                    }
                    
            else
                    {
                        
            while( node[3!= 2 ) changetop( 32 ) ;
                    }
            //旋轉完畢--左邊node[1] = 1 ;上邊node[3] = 2 || 3 

                    dice[i].num 
            = i ; dice[i].val = 0 ; int w = 10000000 ;
                    
            forint k=1; k<=6; k++ ) 
                    {
                        dice[i].val 
            += node[k] * w ; w = w / 10 ;
                        
            //dice[i].node[k-1] = node[k]+'0' ;
                    }
                }
            }

            int cmp( const void *a, const void *b )
            {
                
            struct DICE *= (struct DICE *)a ;
                
            struct DICE *= (struct DICE *)b ;

                
            //if( 0 == strcmp( c->node, d->node ) )
                if( c->val != d->val )
                    
            return c->val - d->val ;
                
            else
                    
            return c->num - d->num ;
            }

            void process()
            {
                qsort( dice
            +1, inn, sizeof(dice[1]), cmp ) ;
            }

            int outcmp( const void *a, const void * b )
            {
                
            struct OUT *= (struct OUT *)a ;    
                
            struct OUT *= (struct OUT *)b ;

                
            return c->num[0- d->num[0] ;
            }

            void output()
            {
                
            int ct_out = 0 ;

                
            forint i=1; i<=inn; i++ )
                {
                    
            if( dice[i].val != dice[i-1].val ) 
                    {
                        ct_out
            ++ ;
                        
            out[ct_out].len = 0 ;
                        
            out[ct_out].num[out[ct_out].len++= dice[i].num ;
                    }
                    
            else
                    {
                        
            out[ct_out].num[out[ct_out].len++= dice[i].num ;
                    }
                }

                qsort( 
            out+1, ct_out, sizeof(out[0]), outcmp ) ;

                printf( 
            "%d\n", ct_out ) ;
                
            forint i=1; i<=ct_out; i++ )
                {
                    
            forint k=0; k<out[i].len; k++ )
                        printf( 
            "%d "out[i].num[k] ) ;
                    printf( 
            "\n" ) ;
                }
            }

            int main()
            {
                
            //freopen( "frac1.in", "r", stdin ) ;
                
            //freopen( "frac1.out","w",stdout ) ;
                
            //freopen( "in.txt", "r", stdin ) ;
                
            //freopen( "out.txt", "w", stdout ) ;

                
            while( scanf( "%d"&inn ) != EOF )
                {
                    input() ;

                    process() ;

                    output() ;
                }

                
            return 0 ;
            }
            日本欧美久久久久免费播放网| 国产综合精品久久亚洲| 午夜精品久久久内射近拍高清 | 国产精品美女久久久久AV福利 | 精品久久久久久久国产潘金莲 | 国产亚洲精午夜久久久久久| 久久无码精品一区二区三区| 伊人久久大香线蕉综合5g| 久久九九精品99国产精品| 亚洲国产成人久久综合碰碰动漫3d| 久久伊人精品青青草原日本| 久久人人妻人人爽人人爽| 久久国产精品视频| 久久精品人成免费| 久久亚洲精品国产精品婷婷| 久久香综合精品久久伊人| 日韩久久久久中文字幕人妻| 精品久久久久久亚洲精品| 久久露脸国产精品| www久久久天天com| 伊人久久综合无码成人网| 91麻豆精品国产91久久久久久 | 无遮挡粉嫩小泬久久久久久久| 国产精品va久久久久久久| 97久久超碰成人精品网站| 无码任你躁久久久久久老妇App| 久久香蕉一级毛片| 久久精品国内一区二区三区| 男女久久久国产一区二区三区| 97精品伊人久久大香线蕉| 日本加勒比久久精品| 日韩中文久久| 亚洲精品tv久久久久| 久久国产成人午夜aⅴ影院| 久久国产精品国产自线拍免费| 亚洲女久久久噜噜噜熟女| 人妻无码久久精品| 香蕉久久永久视频| 久久精品免费大片国产大片| 亚洲成色999久久网站| 中文精品久久久久国产网址|