icpc:problems:luogup1233
差别
这里会显示出您选择的修订版和当前版本之间的差别。
icpc:problems:luogup1233 [2024/03/26 02:51] – 创建 温婕莺 | icpc:problems:luogup1233 [2024/03/26 02:51] (当前版本) – 温婕莺 | ||
---|---|---|---|
行 8: | 行 8: | ||
<code c++> | <code c++> | ||
- | # | + | #include <algorithm> |
- | # | + | #include <cstdio> |
using namespace std; | using namespace std; | ||
- | struct node{ | + | struct node { |
int l, w; | int l, w; | ||
}; | }; | ||
行 24: | 行 24: | ||
int n; | int n; | ||
scanf(" | scanf(" | ||
- | for(int i=1; i<=n; i++) | + | for (int i = 1; i <= n; i++) |
scanf(" | scanf(" | ||
- | sort(line+1, | + | sort(line + 1, line + 1 + n, cmp); |
- | for(int i=1; i<=n; i++) { | + | for (int i = 1; i <= n; i++) { |
- | for(int j=i-1; j>=1; j--) | + | for (int j = i - 1; j >= 1; j--) |
- | if(line[j].w > line[i].w) | + | if (line[j].w > line[i].w) |
f[i] = max(f[i], f[j] + 1); | f[i] = max(f[i], f[j] + 1); | ||
} | } | ||
int ans = 0; | int ans = 0; | ||
- | for(int i=1; i<=n; i++) | + | for (int i = 1; i <= n; i++) |
ans = max(ans, f[i]); | ans = max(ans, f[i]); | ||
- | printf(" | + | printf(" |
return 0; | return 0; | ||
} | } |
/app/www/public/data/pages/icpc/problems/luogup1233.txt · 最后更改: 2024/03/26 02:51 由 温婕莺