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

            學習心得(code)

            superlong@CoreCoder

              C++博客 :: 首頁 :: 聯系 :: 聚合  :: 管理
              74 Posts :: 0 Stories :: 5 Comments :: 0 Trackbacks

            公告

            文字可能放在http://blog.csdn.net/superlong100,此處存放代碼

            常用鏈接

            留言簿(4)

            我參與的團隊

            搜索

            •  

            最新隨筆

            最新評論

            • 1.?re: Poj 1279
            • 對于一個凹多邊形用叉積計算面積 后能根據結果的正負來判斷給的點集的時針方向?
            • --bsshanghai
            • 2.?re: Poj 3691
            • 你寫的這個get_fail() 好像并是真正的get_fail,也是說fail指向的串并不是當前結點的子串。為什么要這樣弄呢?
            • --acmer1183
            • 3.?re: HDU2295[未登錄]
            • 這個是IDA* 也就是迭代加深@ylfdrib
            • --superlong
            • 4.?re: HDU2295
            • 評論內容較長,點擊標題查看
            • --ylfdrib
            • 5.?re: HOJ 11482
            • 呵呵..把代碼發在這里很不錯..以后我也試試...百度的編輯器太爛了....
            • --csuft1

            閱讀排行榜

            評論排行榜

            #include <stdio.h>
            #include 
            <string.h>
            #include 
            <math.h>

            #define eps 1e-8
            #define zero(x) (((x)>0?(x):-(x))<eps)

            struct point{
                
            double x, y, z;
                
            void read() {
                    scanf(
            "%lf %lf %lf"&x, &y, &z);
                }

                
            void out() {
                    printf(
            "%lf %lf %lf\n", x, y, z);
                }

            }
            ;

            point unit(point u) 
            {
                point ret;
                
            double t = sqrt(u.x*u.x+u.y*u.y+u.z*u.z);
                ret.x 
            = u.x / t;
                ret.y 
            = u.y / t;
                ret.z 
            = u.z / t;
                
            return ret;
            }


            point xmult(point u, point v) 
            {
                point ret;
                ret.x 
            = u.y * v.z - v.y * u.z;
                ret.y 
            = u.z * v.x - u.x * v.z;
                ret.z 
            = u.x * v.y - u.y * v.x;
                
            return ret;
            }


            double vlen(point p) {
                
            return sqrt(p.x*p.x+p.y*p.y+p.z*p.z);
            }


            point subt(point u, point v) 
            {
                point ret;
                ret.x 
            = u.x - v.x;
                ret.y 
            = u.y - v.y;
                ret.z 
            = u.z - v.z;
                
            return ret;
            }


            point pvec(point s1, point s2, point s3) 
            {
                
            return xmult(subt(s1, s2), subt(s2, s3));
            }


            double dmult(point u, point v) {
                
            return u.x * v.x + u.y * v.y + u.z * v.z;
            }


            int dots_onplane(point a, point b, point c, point d) {
                
            return zero( dmult( pvec(a, b, c), subt(d, a)));
            }


            int same_side(point p1, point p2, point s1, point s2, point s3) {
                
            return dmult(pvec(s1, s2, s3), subt(p1, s1)) * dmult(pvec(s1, s2, s3), subt(p2, s1)) > eps;
            }


            int opposite_side(point p1, point p2, point s1, point s2, point s3) {
                
            return dmult(pvec(s1, s2, s3), subt(p1, s1)) * dmult(pvec(s1, s2 ,s3), subt(p2, s1)) < -eps;
            }


            int intersect_ex(point l1, point l2, point s1, point s2, point s3) {
                
            return opposite_side(l1, l2, s1, s2, s3) && opposite_side(s1, s2, l1, l2, s3) &&
                       opposite_side(s2, s3, l1, l2, s1) 
            && opposite_side(s3, s1, l1, l2, s2);
            }


            int dot_inplane_in(point p, point s1, point s2, point s3) {
                
            return zero(vlen(xmult(subt(s1, s2),subt(s1, s3)))-vlen(xmult(subt(p,s1),subt(p,s2)))-
                            vlen(xmult(subt(p, s2), subt(p, s3)))
            -vlen(xmult(subt(p,s3), subt(p,s1))));
            }


            point ini, dic, goal[
            8], end, mid;

            int main() {
                
            int cases;
                scanf(
            "%d"&cases);
                
            for(int t = 1; t <= cases; t ++{
                    ini.read();
                    dic.read();
                    
            for(int i = 0; i < 8; i ++)
                        goal[i].read();
                    
            bool flag = false;
                    
            if( opposite_side(ini, goal[7], goal[0], goal[1], goal[2]) > 0 ||
                        dots_onplane(ini, goal[
            0], goal[1], goal[2])  ) {
                        
                        end.x 
            = ini.x + dic.x * 10000000;
                        end.y 
            = ini.y + dic.y * 10000000;
                        end.z 
            = ini.z + dic.z * 10000000;
                        
                        mid.x 
            = (goal[0].x + goal[2].x) / 2;
                        mid.y 
            = (goal[0].y + goal[2].y) / 2;
                        mid.z 
            = (goal[0].z + goal[2].z) / 2;
                        
                        point tt, ts;
                        tt.x 
            = mid.x - ini.x; tt.y = mid.y - ini.y; tt.z = mid.z - ini.z;
                        tt 
            = unit(tt);
                        ts 
            = unit(dic);
                        flag 
            = false;
                        
            for(int i = 0; i < 4; i ++{
                            
            if( intersect_ex(ini, end, goal[i], goal[(i+1)%4],goal[(i+2)%4]) ) {
                                    flag 
            = true;
                            }

                        }

                        
            if!flag && !dots_onplane(ini, goal[0], goal[1], goal[2]) &&
                            ts.x 
            == tt.x && ts.y == tt.y && ts.z == tt.z )     flag = true;
                        
                        
            if!flag && opposite_side(ini, end, goal[4], goal[5], goal[6]) ) {
                            
            for(int i = 0; i < 4; i ++{
                                
            if( dot_inplane_in(ini, goal[i], goal[(i+1)%4],goal[(i+2)%4]) )
                                    flag 
            = true;
                            }

                        }

                    }

                    printf(
            "Case %d: ", t);
                    
            if(flag) {
                        puts(
            "Stupid Larrionda!!!");
                    }
             else {
                        puts(
            "Intelligent Larrionda!!!");
                    }

                }
                
                
            return 0;
            }

            posted on 2010-07-22 17:34 superlong 閱讀(168) 評論(0)  編輯 收藏 引用
            亚洲欧美日韩中文久久| 国内精品久久久久影院亚洲| 久久精品人人做人人爽电影蜜月 | 波多野结衣中文字幕久久| 国产精品久久新婚兰兰| 日本WV一本一道久久香蕉| 乱亲女H秽乱长久久久| 99久久婷婷免费国产综合精品| 国产精品久久波多野结衣| 久久夜色撩人精品国产| 囯产精品久久久久久久久蜜桃| 久久久久久久综合日本亚洲| 久久综合色老色| 久久久久国产一级毛片高清版| 国内精品伊人久久久影院| 伊人丁香狠狠色综合久久| 伊人久久综合无码成人网| 国产高潮国产高潮久久久91| 久久精品无码专区免费东京热| 一本综合久久国产二区| 精品久久人人爽天天玩人人妻| 久久精品欧美日韩精品| 精品久久久久久无码不卡| 久久国产综合精品五月天| 久久国产乱子精品免费女| 一本久久知道综合久久| 伊人久久无码精品中文字幕| 久久精品国产亚洲精品| 久久青青草原精品国产| 国产成人精品三上悠亚久久| 久久99国产乱子伦精品免费| 久久午夜无码鲁丝片秋霞| 国产L精品国产亚洲区久久| 99久久无色码中文字幕| 国产精品对白刺激久久久| 色欲久久久天天天综合网精品| 久久99热这里只有精品66| 国产精品久久久久久久人人看| 久久人人爽人人爽人人片av麻烦 | 久久久精品国产亚洲成人满18免费网站| 亚洲AV无码久久精品色欲|