http://codeforces.com/problemset/problem/451/B

取前后第一个不满足条件的位置,逆序,判断。

#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std; int main()
{
int n,a[],left = ,right = ;
cin >> n;
for(int i = ;i <= n;i++)
{
cin >> a[i];
}
for(int i = ;i <= n-;i++)
{
if(a[i] > a[i+])
{
left = i;
break;
}
}
for(int i = n;i > ;i--)
{
if(a[i] < a[i-])
{
right = i;
break;
}
}
reverse(a+left,a+right+);
int flag = ;
for(int i = ;i <= n-;i++)
{
if(a[i] > a[i+])
{
flag = ;
break;
}
}
if(flag)
{
printf("yes\n");
printf("%d %d\n",left,right);
}
else
{
printf("no\n");
}
return ;
}

最新文章

  1. 【C#】【Thread】SpinWait
  2. c++之string.find(string)
  3. git的合并与推送
  4. JDBC连接Oracle数据库的问题
  5. 多线程学习之AsyncOperation实现线程间交互
  6. CI 更新字段
  7. PHP文章关键词相似短尾长尾内链替换方法介绍
  8. Java集合类总结
  9. bt 介绍以及 bt 种子的hash值(特征值)计算
  10. DIV+CSS区块框浮动设计
  11. Python模块的介绍
  12. Android Push Notifications using Google Cloud Messaging (GCM), PHP and MySQL
  13. 常量指针(const X*)和指针常量(X* const)
  14. HDU1548:A strange lift
  15. Crossin-8-1;8-2课程记录
  16. oracle11g导出表时会发现少表,空表导不出解决方案
  17. const,static,volatile关键字的作用
  18. vue中兄弟组件间通讯
  19. flex布局demo
  20. 使用python来批量抓取网站图片

热门文章

  1. Asp.Net Core下的开源任务调度平台ScheduleMaster
  2. RocketMQ客户端加载流程
  3. Spring学习记录3——Spring AOP
  4. python中各种文件打开模式
  5. Kafka日志压缩剖析
  6. 双射 - hash去重
  7. LCA - 求任意两点间的距离
  8. RSA 的加密 解密
  9. MySQL 行列相互转换
  10. http请求头中的content-type属性