题目:http://www.lydsy.com/JudgeOnline/problem.php?id=1258

如果最后一位是4,那就改成123就好了。

然后最后一位不是4的话,至多三个答案,然后可以发现把给的串最后一个改成4的一定会有。然后可以发现1继承其祖先12的,2继承13的,3继承23的,然后扫一遍。。

(口胡了这么多还是自己找找规律吧TAT

#include<cstring>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#define rep(i,l,r) for (int i=l;i<=r;i++)
#define down(i,l,r) for (int i=l;i>=r;i--)
#define clr(x,y) memset(x,y,sizeof(x))
#define maxn 2000
using namespace std;
int n,f[];
char s[maxn];
int read(){
int x=,f=; char ch=getchar();
while (!isdigit(ch)) {if (ch=='-') f=-; ch=getchar();}
while (isdigit(ch)) {x=x*+ch-''; ch=getchar();}
return x*f;
}
void out(){
putchar('T');
rep(i,,n-) putchar(s[i]);
puts("");
}
int main(){
// freopen("in.txt","r",stdin);
scanf("%s",s);
n=strlen(s)-;
if (s[n]==''){
rep(i,,){
putchar('T');
rep(j,,n-) putchar(s[j]);
printf("%d\n",i);
}
return ;
}
if (s[n]=='') f[]=f[]=;
if (s[n]=='') f[]=f[]=;
if (s[n]=='') f[]=f[]=;
out();
while (--n){
int x=s[n]-'';
if (x==) {
if (f[]) f[]=,out();
}
if (x==){
if (f[]) f[]=,out();
}
if (x==){
if (f[]) f[]=,out();
}
}
return ;
}

最新文章

  1. bootstrap插件引用
  2. cloudera learning8:MapReduce and Spark
  3. 习课的redis配置记录
  4. thinkphp遗留问题
  5. 关注web前端
  6. D3.js 简介和安装
  7. get/close not same thread Druid 连接池一个设置
  8. DB天气app冲刺二阶段第四天
  9. mysql修改字段的语句写法
  10. PDFium-PDF开源之旅(1)-初探代码下载编译
  11. 网站生产app的一些网址
  12. java:Comparable比较器
  13. webpack 3.X学习之JS压缩与打包HTML文件
  14. AutoMapper在asp.netcore中的使用
  15. Flask Ansible自动化平台搭建(持续更新)
  16. 谈谈 ANR 之 Service 超时
  17. C# 为所有 CheckBox 添加事件
  18. H5选择颜色-前端颜色选择器
  19. C# [IPA]IOS In App Purchase(内购)验证(asp.net 版本)
  20. mysql分组后将未分组的列合并成行GROUP BY,GROUP_CONCAT

热门文章

  1. iOS 蓝牙开发资料记录
  2. 仿知乎app登录界面(Material Design设计框架拿来就用的TexnInputLayout)
  3. php date函数
  4. 如何在yarn上运行Hello World(二)
  5. Saltstack的安装和配置
  6. 使用jQuery制作一个简易的购物车结算流程
  7. gitlab 升级
  8. 用纯CSS实现的箭头
  9. 使用nginx 的反向代理 给 kibana加上basic的身份认证
  10. Linux入门篇(三)——文件与目录