<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12
      書山有徑勤為路>>>>>>>>

      <<<<<<<<學(xué)海無涯苦作舟!

      Floyd算法解決 Jump

      Description

      There is n pillar, their heights are (A1,A2,A3,…An).you can jump at the top of the pillars. But you will lose abs(a[j]-a[i])*abs(j-i) power when you jump from i-th pillar to j-th pillar. At first you have m power. Can you jump from s-th pillar to e-th pillar.

      Input

       

      The input consists of several test cases.

      every test case is two integer n(2<=n<200),q(1=<q<=10000).

      The second line contain n integer A1,A2,A3,..An.

      The next q line contain there integer s,e,m.

       

      Output

      If you can jump from s to e, with less or equal m power output “Yes”, else output “No”

      Sample Input

      3 3
      1 2 3
      1 3 2
      1 2 1
      1 3 1

      Sample Output

      Yes
      Yes
      No
      
      
      這里的能量就相當(dāng)于距離了。
      
      
      View Code
      #include "iostream"
      using namespace std;
      #define size 201
      int abs(int x)
      {
          return x>=0?x:-x;
      }
      int main()
      {
          int n, q, f[size][size];
          while(cin>>n>>q)
          {
              int i, j, k;
              int p[size];
              for(i=0; i<n; i++)
                  cin>>p[i];
              for(i=0; i<n; i++)
                  for(j=0; j<n; j++)
                      f[i][j] = abs(p[i]-p[j])*abs(i-j);
              for(k=0; k<n; k++)
                  for(i=0; i<n; i++)
                      for(j=0; j<n; j++)
                          if(f[i][k]+f[k][j]<f[i][j])
                              f[i][j] = f[i][k]+f[k][j];
              while(q--)
              {
                  int s, e, m;
                  cin>>s>>e>>m;
                  if(f[s-1][e-1]<=m)
                      cout<<"Yes"<<endl;
                  else
                      cout<<"No"<<endl;
              }
          }
          return 0;
      }
      
      

       

       

      posted on 2011-10-18 11:03  More study needed.  閱讀(279)  評論(0)    收藏  舉報(bào)

      導(dǎo)航

      書山有徑勤為路>>>>>>>>

      <<<<<<<<學(xué)海無涯苦作舟!

      主站蜘蛛池模板: 色成人亚洲| 国产极品美女高潮无套| 日韩亚洲国产中文字幕欧美| 国产成人综合亚洲第一区| 激情亚洲专区一区二区三区 | 欧美va天堂在线电影| 久久大香线蕉国产精品免费| 久久精品视频一二三四区| 国产成人无码AV片在线观看不卡| 亚洲精品岛国片在线观看| 国产自拍在线一区二区三区| 高清性欧美暴力猛交| 亚洲人成网站观看在线观看| 九九热在线精品视频首页| 国产亚洲精久久久久久无码77777| 中文字幕成熟丰满人妻| 无码专区 人妻系列 在线| 高级艳妇交换俱乐部小说| 亚洲欧洲日产国码久在线| 色猫咪av在线网址| 果冻传媒mv免费播放在线观看| 国模肉肉视频一区二区三区| 真人性囗交视频| 达日县| 天天看片视频免费观看| 亚洲国产一区二区三区亚瑟| 亚洲国产精品日韩在线| 曝光无码有码视频专区| 桃花岛亚洲成在人线AV| 亚洲中文字幕无码永久在线| 亚洲欧美日韩综合一区二区| 国产清纯在线一区二区| 精品日本乱一区二区三区| 嫩草研究院久久久精品| 91老肥熟女九色老女人| 精品国产免费第一区二区三区| 亚洲乱熟女一区二区三区| 亚洲第一香蕉视频啪啪爽| 免费人成视频x8x8国产| 亚洲中文字幕无码日韩精品| 娇小萝被两个黑人用半米长|