zoukankan      html  css  js  c++  java
  • hdu 5972 Regular Number

    Regular Number

    Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
    Total Submission(s): 620    Accepted Submission(s): 134


    Problem Description
    Using regular expression to define a numeric string is a very common thing. Generally, use the shape as follows:
    (0|9|7) (5|6) (2) (4|5)
    Above regular expression matches 4 digits:The first is one of 0,9 and 7. The second is one of 5 and 6. The third is 2. And the fourth is one of 4 and 5. The above regular expression can be successfully matched to 0525, but it cannot be matched to 9634.
    Now,giving you a regular expression like the above formula,and a long string of numbers,please find out all the substrings of this long string that can be matched to the regular expression.
     
    Input
    It contains a set of test data.The first line is a positive integer N (1 ≤ N ≤ 1000),on behalf of the regular representation of the N bit string.In the next N lines,the first integer of the i-th line is ai(1ai10),representing that the i-th position of regular expression has ai numbers to be selected.Next there are ai numeric characters. In the last line,there is a numeric string.The length of the string is not more than 5 * 10^6.
     
    Output
    Output all substrings that can be matched by the regular expression. Each substring occupies one line
     
    Sample Input
    4 3 0 9 7 2 5 7 2 2 5 2 4 5 09755420524
     
    Sample Output
    9755 7554 0524
     
    Source
     
    Recommend
     
     
     
  • 相关阅读:
    网页收藏
    background 和IMG的差异
    cefsharp开发实例1
    Node.js系列之node.js初探
    sublime3安装package controller遇到的问题
    java 指定日期加指定天数
    svn 命令
    mac下nodejs 更新到最新版本的最新方法
    mac系统安装redis
    sublime 安装插件
  • 原文地址:https://www.cnblogs.com/gongpixin/p/6794492.html
Copyright © 2011-2022 走看看