编程介的小学生 2019-01-22 20:19 采纳率: 20.5%
浏览 452

C语言用二分查找的方式来检索字符串string,请问C语言的方式和思路

Problem Description
Everybody knows the number is saved with the binary string in the computer. Now, their have N (1 <= N <= 1000) binary strings I tell you, your task is tell me what is the most binary substring with K (1 <= K <= L) characters in the strings I give you. The length of each string is L (1 <= L <= 60). Output times of the most appearing binary substring.

Input
Each line will contain three numbers N, L, K.
Following N lines, represent N binary strings.

Output
One answer one line.

Sample Input
2 6 3
101011
110101
2 6 4
101011
110101

Sample Output
4
2

  • 写回答

2条回答 默认 最新

  • weixin_44207816 2019-01-22 21:10
    关注

    二分查找的基本思想是将所要査找的序列的中间位置的数据与所要査找的元素进行比较,如果相等,则表示査找成功,否则将以该位置为基准将所要査找的序列分为左右两部分。

    接下来根据所要査找序列的升降序规律及中间元素与所查找元素的大小关系,

    评论

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题