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