分析

超级暴力,在尾部+1,再判断。

AC代码

type
arr=array[0..27]of longint;
var
st:string;
a:array[0..27]of longint;
s,t,w,i:longint; procedure print(a:arr);
var
i:longint;
begin
for i:=w downto 1 do write(chr(a[i]+96)); writeln;
end; function check(a:arr):boolean;
var
i:longint;
begin
for i:=w-1 downto 1 do
if (a[i+1]<=a[i])and(not((a[i]>=s)and(a[i]<=t)and(a[i+1]>=s)and(a[i+1]<=t))) then exit(false);
exit(true);
end; procedure solve(a:arr);
var
i,cnt,kkk:longint;
begin
cnt:=0;
while cnt<5 do
begin
inc(a[1]); kkk:=1;
for i:=1 to w do
if a[i]>t then
begin
a[i]:=s;
inc(a[i+1]);
end;
for i:=w-1 downto 1 do
if a[i]<a[i+1] then a[i]:=a[i+1]+1;
//print(a);
if check(a) then
begin
inc(cnt); print(a);
end;
end;
end; begin
readln(s,t,w);
readln(st);
for i:=w downto 1 do a[i]:=ord(st[w-i+1])-ord('a')+1;
solve(a);
end.

最新文章

  1. 在Asp.Net中操作PDF – iTextSharp - 使用表格
  2. 洛谷P1134 阶乘问题[数论]
  3. ftp服务配置文件记录
  4. SqlServer性能检测和优化工具使用详细(转)
  5. Python在Windows下安装第三方库浅谈
  6. JavaWeb学习之JSTL自定义标签库的使用、JSTL自定义函数库(7)
  7. 抓发请求&amp;设置默认工程
  8. protected(C# 参考)
  9. Python顺序集合之 tuple
  10. centos yum安装mysql
  11. HDU 5479 Scaena Felix
  12. python常量 变量 数据类型 注释 交互 if语句
  13. mybatis查询到count(*)返回值
  14. react native 中使用swiper
  15. java 控制台输入
  16. 关于flex的crossdomain.xml文件存放目录
  17. I/O事件处理模型之Reactor和Proactor 【转】
  18. 《SLAM for Dummies》中文版《SLAM初学者教程》
  19. android 开发 简单的小计算器
  20. 记一次 oracle 12.2 RAC : Transaction recovery: lock conflict caught and ignored

热门文章

  1. SpringCloud01:微服务概述
  2. (3)虚拟Web主机
  3. 【NX二次开发】按层查找工作部件中的对象 UF_LAYER_cycle_by_layer
  4. storage事件中的坑,storage.setItem()无法触发storage事件
  5. 【题解】PIZZA 贪心
  6. 连接过的WiFi改了密码之后再次连接不让输入新密码还是用旧密码一直显示连接失败
  7. SQL 利用存储过程实现对表数据有则更新无则添加(转)
  8. Java反射机制开发经验总结
  9. 使用kubeadm进行k8s集群升级
  10. 【知识点】inline函数、回调函数、普通函数