NYOJ-79 拦截导弹 AC
2014-01-01 23:25
162 查看
#include<stdio.h> int main(){ int num[1000]={0}; int n,m,x,y; scanf("%d",&n); while(n--){ int max=0; int sum[1000]={0}; scanf("%d",&m); for(x=0;x<m;x++){ scanf("%d",&num[x]); } for(x=m;x>=0;x--){ for(y=x;y<=m-1;y++){ if((num[y]<num[x])&&(sum[x]<=sum[y])){ sum[x]=sum[y]+1; } } if(sum[x]>max)max=sum[x]; } printf("%d\n",max+1); } return 0; }
以前总是WA,今天重写了代码,终于AC了
相关文章推荐
- NYOJ-79 拦截导弹 AC 分类: NYOJ 2014-01-01 23:25 167人阅读 评论(0) 收藏
- nyoj-79 拦截导弹
- NYOJ 79 拦截导弹 (寻找递减最长子序列)
- NYOJ-79-拦截导弹
- nyoj-79-拦截导弹
- NYOJ 79 拦截导弹 (最长递减子序列)
- NYOJ 79 拦截导弹
- NYOJ-79:拦截导弹
- NYOJ 79 拦截导弹
- nyoj 拦截导弹 79 (转换为LIS)
- nyoj 79 拦截导弹 (LIS)
- NYOJ - 79 - 拦截导弹(动态规划--LIS--最长递增子序列变形)
- nyoj 79 拦截导弹
- NYOJ 79 导弹拦截
- nyoj 79 拦截导弹 连续递减最长子序列(动态规划)
- nyoj 79 拦截导弹
- NYOJ79 拦截导弹 【动态规划】
- DP入门50题(4)——NYoj79 导弹拦截
- NYoj 79 导弹拦截[典型动态规划1]
- nyoj 79 导弹拦截