• <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 閱讀(150) 評論(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 ;
            }
            久久久一本精品99久久精品66| 久久夜色精品国产欧美乱| 久久久女人与动物群交毛片| 久久精品无码专区免费东京热 | 久久综合丁香激情久久| 国产欧美久久一区二区| 欧美久久久久久| 国产精品一久久香蕉产线看| 久久精品国产男包| 国产精品女同久久久久电影院| 国产午夜福利精品久久| 精品综合久久久久久98| 国产69精品久久久久99尤物| 久久久久久综合网天天| 久久99国产一区二区三区| 国产成人久久精品一区二区三区 | 日本久久久久久中文字幕| 久久精品国产亚洲αv忘忧草| 久久99热国产这有精品| 无码人妻久久一区二区三区蜜桃 | 激情五月综合综合久久69| 欧美黑人又粗又大久久久| 久久人人爽人人爽人人片AV麻豆| 久久66热人妻偷产精品9| 区久久AAA片69亚洲| 综合久久一区二区三区| 大美女久久久久久j久久| 国产精品天天影视久久综合网| 亚洲AV无码一区东京热久久| 亚州日韩精品专区久久久| 91精品国产91久久久久久| 久久久久久亚洲Av无码精品专口| 婷婷国产天堂久久综合五月| 久久精品国产精品亚洲| 国产99久久九九精品无码| 久久综合九色综合97_久久久| 99久久精品影院老鸭窝| MM131亚洲国产美女久久| 久久久久国产精品熟女影院| 久久青青草原精品国产| 久久天天躁狠狠躁夜夜躁2O2O|