• <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>
            隨筆 - 62  文章 - 96  trackbacks - 0
            <2006年8月>
            303112345
            6789101112
            13141516171819
            20212223242526
            272829303112
            3456789

            常用鏈接

            留言簿(7)

            隨筆分類(66)

            隨筆檔案(62)

            文章分類(31)

            文章檔案(32)

            友情鏈接

            最新隨筆

            積分與排名

            • 積分 - 235704
            • 排名 - 108

            最新評論

            閱讀排行榜

            評論排行榜

            今天在PKU上做了我第一題廣度優(yōu)先搜索題:
            Problem Id:2627??User Id:beyonlin_SCUT
            Memory:64K??Time:575MS
            Language:C++??Result:Accepted
            個人認(rèn)為算法復(fù)雜度應(yīng)該為O(n^2)或更小。不知是不是這樣。
            http://acm.pku.edu.cn/JudgeOnline/problem?id=2627

            Gopher and hawks
            Time Limit:1000MS? Memory Limit:65536K
            Total Submit:900 Accepted:328

            Description
            A gopher sits in a hole located at (xs, ys) and wants to get to a hole located at (xt, yt). The gopher can run at a constant speed of v m/sec. However, if the gopher is outside of a hole for more than a m minutes he will become a supper to hawks flying over the holes. Can the gopher make it?

            Input
            The first line of input contains two positive integer numbers: v -- gopher's speed in meters per second and m -- the time after which the gopher becomes prey to hawks if he stays outside a hole. The second line of input contains two floating point numbers: the (xs,ys) coordinates of the gopher starting hole. The third line contains the (xt, yt) coordinates of the target hole. Each Subsequent line of input contains two floating point numbers: the (x,y) coordinates of a gopher hole. All distances are in metres, to the nearest mm.

            Output
            If the gopher can make it to the target hole, the output line should read "Yes, visiting n other holes.", where n is the minimal number of intermediate holes the gopher has to visit. If the gopher cannot make it the output line should read "No." There are not more than 1000 gopher holes and all coordinates are between -10000 and +10000.

            Sample Input

            3 1
            0.000 0.000
            500.000 0.000
            179.000 0.000
            358.000 0.000
            

            Sample Output

            Yes, visiting 2 other holes.
            

            Hint
            Sample input 2
            5 1
            0.000 0.000
            0.000 550.000
            179.000 0.000
            0.000 301.000

            Output for sample input 2
            No.


            我的程序:

            #include<cstdio> #include<cmath> #include<queue> using namespace std; struct node { int point; int step; }; double x[1100],y[1100]; bool flag[1100]={false}; int main() { int i,v,t; scanf("%d%d",&v,&t); t*=60; double beginX,beginY,endX,endY; scanf("%lf%lf%lf%lf",&beginX,&beginY,&endX,&endY); int n=1; while(scanf("%lf%lf",x+n,y+n)!=EOF) n++; x[0]=beginX; y[0]=beginY; x[n]=endX; y[n]=endY; node n1;//隊列初始化 n1.point=0; n1.step=0; queue<node> que; que.push(n1); int steps=0; while(true) { if(que.empty()) break; node tmp=que.front(); que.pop();//出隊列 for(i=1;i<=n;i++) { if(!flag[i])//標(biāo)志是否進(jìn)過隊列 { double time=sqrt(pow(x[i]-x[tmp.point],2.0)+pow(y[i]-y[tmp.point],2.0))/v; if(time<t) { if(i==n) { steps=tmp.step; goto next; } else { node in; in.point=i; in.step=tmp.step+1; que.push(in);//進(jìn)隊列 flag[i]=true; } } } } } next: if(steps!=0) printf("Yes, visiting %d other holes.\n",steps); else printf("No.\n"); return 0; }

            posted on 2006-08-24 10:25 beyonlin 閱讀(595) 評論(0)  編輯 收藏 引用 所屬分類: acm之路
            久久久久一区二区三区| 亚洲国产精品久久电影欧美| 亚洲乱亚洲乱淫久久| 精品国产婷婷久久久| 香蕉久久夜色精品国产尤物| 久久夜色精品国产网站| 青草影院天堂男人久久| 亚洲欧美久久久久9999| 久久精品国产第一区二区三区 | 无码专区久久综合久中文字幕| 亚洲国产精品无码久久久不卡| 91性高湖久久久久| 亚洲AV无码久久精品色欲| 色综合久久88色综合天天| 狠狠色婷婷久久综合频道日韩 | 91久久婷婷国产综合精品青草 | 久久久久99精品成人片三人毛片 | 久久丝袜精品中文字幕| 色综合久久中文字幕无码| 久久久精品国产亚洲成人满18免费网站| 中文字幕久久精品无码| 久久久久国产| 国产2021久久精品| 精品久久久久久久| 婷婷久久久亚洲欧洲日产国码AV | 国产欧美久久久精品| 99久久精品国产一区二区| 色播久久人人爽人人爽人人片aV | 中文国产成人精品久久亚洲精品AⅤ无码精品 | 成人妇女免费播放久久久| 亚洲va久久久噜噜噜久久天堂| 性做久久久久久久久老女人| 狠狠人妻久久久久久综合| 国产A级毛片久久久精品毛片| 91久久婷婷国产综合精品青草| 97久久久久人妻精品专区| 久久综合给合久久狠狠狠97色| 亚洲AV无码成人网站久久精品大| 中文字幕人妻色偷偷久久| 久久久久久午夜成人影院| 久久久久久国产精品无码超碰|