国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

poj2533純最長上升子序列

2019-11-06 06:24:45
字體:
來源:轉載
供稿:網友
/-------------------------------------------------------沒什么好說的純最長上身子序列#include <iostream>#include <cstdio>#include <algorithm>#include <cstring>using namespace std;const int maxn = 1000+10;int dp[maxn];int num[maxn];int n;int lis(){    int core = 1, ans = 1;    dp[1] = 1;    for(int i = 2; i <= n; i++){        int core = 0;        for(int j = 1; j < i; j++){            if(num[j] < num[i] && dp[j] > core){                core = dp[j];            }        }        dp[i] = core + 1;        if(dp[i] > ans) ans = dp[i];    }    return ans;}int main (){    while(scanf("%d", &n) != EOF){        for(int i = 1; i <= n; i++)scanf("%d", &num[i]);        cout << lis() << endl;    }    return 0;}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 青海省| 十堰市| 吴堡县| 溧阳市| 天等县| 阳信县| 桐城市| 海淀区| 阳曲县| 文登市| 巴青县| 阜平县| 合肥市| 响水县| 阳山县| 平武县| 阳东县| 临西县| 丽江市| 上饶市| 宣化县| 湖州市| 台北县| 新乡县| 南溪县| 稷山县| 恩施市| 平顶山市| 东兴市| 余江县| 菏泽市| 宁武县| 苗栗县| 都昌县| 太仆寺旗| 安康市| 赤水市| 太保市| 石嘴山市| 肃南| 固镇县|