zoukankan      html  css  js  c++  java
  • bzoj1207 [HNOI2004]打鼹鼠

    题目链接

    一道比较简单的DP

    距离够则转移

     1 #include<iostream>
     2 #include<cstdio>
     3 #include<cstdlib>
     4 #include<string>
     5 #include<cstring>
     6 #include<cmath>
     7 #include<algorithm>
     8 #include<ctime>
     9 #include<queue>
    10 #include<stack>
    11 #include<map>
    12 #include<set>
    13 using namespace std;
    14 int n,m,t[10010],x[10010],y[10010],hh[10010];
    15 int jue(const int &x)
    16 {
    17     return x<0?-x:x;
    18 }
    19 int dis(const int &q,const int &w,const int &e,const int &r)
    20 {
    21     return jue(q-e)+jue(w-r);
    22 }
    23 int main()
    24 {
    25     scanf("%d%d",&n,&m);
    26     for(int i=1;i<=m;i++)
    27     {
    28         scanf("%d%d%d",&t[i],&x[i],&y[i]);
    29         hh[i]=1;
    30     }
    31     for(int i=1;i<=m;i++)
    32         for(int j=1;j<i;j++)
    33             if(t[i]-t[j]>=dis(x[i],y[i],x[j],y[j]))hh[i]=max(hh[i],hh[j]+1);
    34     int ans=0;
    35     for(int i=1;i<=m;i++)ans=max(ans,hh[i]);
    36     printf("%d",ans);
    37     return 0;
    38 }
  • 相关阅读:
    oracle索引学习
    (转载)Windows下手动完全卸载Oracle
    Funsion Charts 学习(二)
    Funsion Charts 学习(一)
    集合操作
    文件操作
    字典操作
    字符串操作
    列表操作
    python基本运算
  • 原文地址:https://www.cnblogs.com/HugeGun/p/5151412.html
Copyright © 2011-2022 走看看