• <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 閱讀(149) 評論(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 ;
            }
            国产欧美久久久精品影院| 久久亚洲国产精品五月天婷| 亚洲狠狠婷婷综合久久蜜芽| 伊人久久精品无码二区麻豆| 国内精品久久人妻互换| 久久噜噜电影你懂的| 一级做a爰片久久毛片看看| 国产精品美女久久久久久2018| 伊人久久大香线焦综合四虎| 久久亚洲中文字幕精品一区| 精品久久久噜噜噜久久久| 久久久青草青青国产亚洲免观| 中文字幕精品久久| 国产精品久久影院| 国产成人精品综合久久久久| 国产成人精品久久亚洲| 久久久免费精品re6| 色99久久久久高潮综合影院| 99久久精品毛片免费播放| 欧美成人免费观看久久| 国产精品欧美久久久久无广告| 少妇高潮惨叫久久久久久| 久久伊人影视| 久久久久亚洲AV无码专区网站 | 国产福利电影一区二区三区久久久久成人精品综合 | 精品无码久久久久国产动漫3d| 久久亚洲精品中文字幕三区| 久久成人国产精品| 7777精品伊人久久久大香线蕉| 久久99久久成人免费播放| 色偷偷888欧美精品久久久| 久久狠狠高潮亚洲精品| 亚洲va国产va天堂va久久| 国内精品久久久久影院老司| 久久久黄片| 欧美亚洲国产精品久久久久| 日本加勒比久久精品| 久久久久久国产a免费观看黄色大片| 99久久亚洲综合精品网站| 色综合合久久天天综合绕视看 | 日韩精品无码久久一区二区三|