题解 | #Redraiment的走法#
Redraiment的走法
https://www.nowcoder.com/practice/24e6243b9f0446b081b1d6d32f2aa3aa
#include <stdio.h> int main() { int a[200]; int n; int i; int j; int max = 1; int value[200] = {0}; int maxvalue = 1; scanf("%d", &n); for(i = 0; i < n; i++) { scanf("%d", &a[i]); } value[n - 1] = 1; for(i = n - 2; i >= 0; i--) { max = 1; for(j = i + 1; j < n; j++) { if(a[j] > a[i] && (1 + value[j]) > max) { max = 1 + value[j]; } } value[i] = max; if(max > maxvalue) maxvalue = max; } printf("%d", maxvalue); return 0; }