• <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>

            我希望你是我獨(dú)家記憶

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

            URAL——1015——(立體旋轉(zhuǎn))

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

             

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

            #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 ) ;
                    }
            //旋轉(zhuǎn)完畢--左邊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 ;
            }
            久久亚洲欧洲国产综合| 国产精品禁18久久久夂久| 久久99精品国产99久久| 久久精品人人做人人爽电影| 久久影视综合亚洲| 久久涩综合| 久久99热这里只有精品66| 一本久久综合亚洲鲁鲁五月天| 武侠古典久久婷婷狼人伊人| 久久综合视频网站| 亚洲一级Av无码毛片久久精品| 久久青青草视频| 日韩av无码久久精品免费| 久久婷婷激情综合色综合俺也去| 亚洲国产精品无码久久一线| 男女久久久国产一区二区三区| 7777久久亚洲中文字幕| 国内精品久久久久久久久电影网| 久久精品国产福利国产琪琪| 人妻系列无码专区久久五月天| 色播久久人人爽人人爽人人片AV| 一本久久a久久精品vr综合| 99久久精品国产免看国产一区| 国产精品无码久久四虎| 久久久久国产精品人妻| 久久Av无码精品人妻系列| 97精品国产97久久久久久免费| 一本一道久久a久久精品综合 | 久久精品国产男包| 久久久久久久久无码精品亚洲日韩| 国产午夜久久影院| 伊人久久亚洲综合影院| 久久66热人妻偷产精品9| 久久精品国产国产精品四凭| 亚洲AV无码1区2区久久| 国产精品亚洲美女久久久| 综合久久国产九一剧情麻豆| 99久久伊人精品综合观看| 伊人久久大香线蕉综合影院首页| 精品一区二区久久| 无码国内精品久久人妻|