NYOJ 370 波动序列
2014-05-23 21:48
176 查看
链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=370
#include <iostream> #include<cstdio> using namespace std; int main() { int t; int n; int i; int a; int last; bool s; int ans; scanf("%d",&t); while(t--) { scanf("%d",&n); s=true; scanf("%d",&last); ans=1; for(i=1;i<n;i++) { scanf("%d",&a); if(!s&&a>last) { ans++; s=true; } else if(s&&a<last) { ans++; s=false; } last=a; } printf("%d\n",ans); } return 0; }
相关文章推荐
- nyoj 370-波动序列
- NYOJ 370 波动序列 (有意思的题)
- NYOJ 370 波动序列
- NYOJ 370 波动序列
- NYOj题目370波动序列(dp)
- NYOJ 370 波动序列 dp 动态规划
- NYOJ370-波动序列
- NYOJ 214 单调递增子序列(二)
- nyoj 17 单调递增最长子序列
- NYOJ 214 单调递增子序列
- NYOJ 17 单调递增最长子序列
- NYOJ-17-单调递增最长子序列
- nyoj 17 单调递增最长子序列
- NYOJ-214 单调递增子序列(二) AC 分类: NYOJ 2014-01-31 08:06 233人阅读 评论(0) 收藏
- nyoj 202 红黑树 【红黑树性质 旋转后中序序列不变】 【二叉树中序遍历】
- nyoj133_子序列_离散化_尺取法
- nyoj 17 单调递增最长子序列(dp---记忆化搜索||穷举|| nlogn算法)
- NYOJ17,单调递增最长子序列
- nyoj_214_单调递增子序列(二)_201403182131
- NYOJ--单调递增最长子序列