hdu 1257 最少拦截系统(DP)
有点水.....测试数据也很水.....
include<stdio.h> int dp[100]; int main() { int n,num,i,top; while(~scanf("%d",&n)) { dp[1] = 0; top = 0; while(n--) { scanf("%d",&num); for(i = 1 ; i <= top ; i ++) if(num <= dp[i]) { dp[i] = num; break; } if(i > top) dp[++top] = num; } printf("%d\n",top); } return 0; } #include<stdio.h> int dp[100]; int main() { int n,num,i,top; while(~scanf("%d",&n)) { dp[1] = 0; top = 0; while(n--) { scanf("%d",&num); for(i = 1 ; i <= top ; i ++) if(num <= dp[i]) { dp[i] = num; break; } if(i > top) dp[++top] = num; } printf("%d\n",top); } return 0; }
补充:软件开发 , C++ ,