POJ 3617 Best Cow Line 字典序最小
2024-09-06 02:42:27
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<set>
#include<string>
#include<cmath>
#include<cstring>
using namespace std;
int main()
{
int n;
scanf("%d",&n);
char str[];
for(int i=;i<n;i++)
{
getchar();
str[i]=getchar();
}
// cout<<str<<endl;
int start=,end=n-;
int cnt=;
while(start<=end)
{
bool left=false;
for(int i=;start+i<=end;i++)
{
if(str[start+i]<str[end-i])
{
left=true;
break;
}
else if(str[start+i]>str[end-i])
{
left=false;
break;
}
}
if(left)
putchar(str[start++]);
else
putchar(str[end--]);
cnt++;
if(cnt%==)
putchar('\n');
}
return ;
}
最新文章
- 在xaf 14 中实现 Tonyyang原文中的action权限
- openssl,db,mysql,sasl编译安装
- C++学习网站(转)
- ArcGisServer根据最大最小坐标换算瓦片行列号(转载)
- 数据库及SQL----常用知识点总结
- nodejs文件操作模块FS(File System)常用函数简明总结(转)
- Eric5 for Python 3.3.3安装指南
- 金三银四,如何征服面试官,拿到Offer
- .net core 2.x - docker(for windows)-linux配置及项目+SqlServer发布
- CSS3 - 盒子的 box - size
- 20170906xlVBA_GetEMailFromDocument
- session和cookie的作用和原理
- zTree的简单例子
- sigmod2017.org
- 轻松解决vuejs跨域
- code_blocks 使用操作手册
- requests中获取请求到文本编码格式
- drop解决过拟合的情况
- [洛谷P5216]DLS 采花
- Jenkins集成selenium