前言

  我竟然还能想起来当时是怎么做的233,题都是随便找的,跟以前的代码重了就重了吧,反正风格变了qaq

  【2017-11-18】其实本来打算写好多好多的水题来着,不过要AFO啦,就不弄啦!

1.codevs 1576 最长严格上升子序列

直通

代码酱(:3▓▒

#include <iostream>
#include <cstdio>
using namespace std;

const int N = 5005;
int n,ans;
int a[N],f[N];

int main() {
    scanf("%d",&n);
    for(int i=1; i<=n; i++) {
        scanf("%d",&a[i]);
        f[i]=1;
        for(int j=i-1; j>=1; j--)
            if(a[i]>a[j])
                f[i]=max(f[i],f[j]+1);
    }
    for(int i=1; i<=n; i++) ans=max(ans,f[i]);
    printf("%d",ans);
    return 0;
}
View Code

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-19
  • 2022-02-04
  • 2022-01-26
  • 2022-12-23
  • 2022-12-23
  • 2021-11-23
相关资源
相似解决方案