• 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 }
  • 相关阅读:
    fs.readdirSync
    symbol
    vuex-count
    webpack2.0
    关于vuex报错
    store
    .NET MVC 验证码
    SQLServer 加密
    IE10、IE11下SCRIPT5009: “__doPostBack”未定义
    Sql Server 增加字段、修改字段、修改类型、修改默认值
  • 原文地址:https://www.cnblogs.com/HugeGun/p/5151412.html
Copyright © 2020-2023  润新知