vijos 1379 字符串的展开
2024-09-05 15:07:25
23333333333333333
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define maxn 1005000
char s[maxn],t[maxn],p[maxn];
int p1,p2,p3,top=-,l;
void work(int x)
{
int l=s[x-],r=s[x+],cnt=;
if ((s[x-]<='') && (s[x+]>'')) {t[++top]='-';return;}
if ((s[x-]=='-') || (s[x+]=='-')) {t[++top]='-';return;}
for (int i=l+;i<=r-;i++)
{
for (int j=;j<=p2;j++)
{
if (p1==)
{
p[++cnt]='*';
continue;
}
if ((s[x-]>='') && (s[x-]<=''))
p[++cnt]=i;
else
{
if (p1==) p[++cnt]=i;
else if (p1==) p[++cnt]=i-;
}
}
}
if (p3==)
{
for (int i=;i<=cnt;i++)
t[++top]=p[i];
}
else
{
for (int i=;i<=cnt;i++)
t[++top]=p[cnt-i+];
}
}
int main()
{
scanf("%d%d%d",&p1,&p2,&p3);
scanf("%s",s);
l=strlen(s);
for (int i=;i<l;i++)
{
if (s[i]!='-')
t[++top]=s[i];
else
{
if (i==) {t[++top]='-';continue;}
if (i==l-) {t[++top]='-';continue;}
if (s[i-]==s[i+]) t[++top]=s[i];
else if (s[i-]>s[i+]) t[++top]=s[i];
else work(i);
}
}
printf("%s",t);
return ;
}
最新文章
- echo中的逗号
- 标签控制器,UITabBarController
- jQuery 遍历
- react.js 从零开始(三)JSX 语法及特点介绍
- jquer 带左右按钮滚动图片 点击显示大图
- iOS性能之HTTP2.0
- Java读取property配置文件
- linux 下文件误删恢复
- leetcode 之 Single Number II
- CA证书理解?CA证书的作用?
- I/O模型之三:两种高性能 I/O 设计模式 Reactor 和 Proactor
- Eclipse中Lombok的安装和注解说明
- [转帖]关于CP936
- YOLO系列:YOLO v1深度解析
- DHCP的搭建
- sublime断点调试
- Programmed Adjustable Power
- ldd 以及 ld-linux.so.2
- Ubuntu 登陆界面无限循环问题 以及 root用户无法使用命令问题
- centos7配置vsftpd服务器