编程介的小学生 2017-10-27 15:26 采纳率: 20.5%
浏览 724
已采纳

Up Sky,Mr.Zhu

Problem Description
Given a string S[0,...n-1],and the length of each palindrome substring in S is less than 20.

Define special string of a palindrome string STR[0,...,n-1] is STR[floor(n/2),...,n-1]

Given L,R and a string T, Query the number of palindrome strings, whose the prefix of special string is T, in S[L,...,R]

ps:floor means the function in C++ language
(No relation between statement and title)

Input
There are severval cases,please peocess until EOF.
The first line contains string S.(1<=|S|<=1e5)
The second line is a number q means the number of querys.(1<=q<=1e5)
The next q lines,each line contains two numbers L,R and a string T.(1<=L<=R<=|S|,1<=|T|<=10)
All strings only contain 'a','b','c','d' and 'e'.

Output
For each query,you should output the number of palindrome strings which satisfied previous condition in a line.

Sample Input
bceaeedde
5
5 8 e
3 5 e
1 2 a
5 9 d
5 9 de

Sample Output
3
2
0
4
1

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-11-14 10:43
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)