摘要: 给定两个由英文字母组成的字符串 String 和 Pattern,要求找到 Pattern 在 String 中第一次出现的位置,并将此位置后的 String 的子串输出。如果找不到,则输出“Not Found”。 本题旨在测试各种不同的匹配算法在各种数据情况下的表现。各组测试数据特点如下: 数据0 阅读全文
posted @ 2019-05-29 21:25 王清河 阅读(1258) 评论(0) 推荐(0) 编辑
摘要: Given a hash table of size N, we can define a hash function (. Suppose that the linear probing is used to solve collisions, we can easily obtain the s 阅读全文
posted @ 2019-05-29 21:22 王清河 阅读(504) 评论(0) 推荐(0) 编辑
摘要: 实现QQ新帐户申请和老帐户登陆的简化版功能。最大挑战是:据说现在的QQ号码已经有10位数了。 输入格式: 输入首先给出一个正整数N(≤),随后给出N行指令。每行指令的格式为:“命令符(空格)QQ号码(空格)密码”。其中命令符为“N”(代表New)时表示要新申请一个QQ号,后面是新帐户的号码和密码;命 阅读全文
posted @ 2019-05-29 21:11 王清河 阅读(447) 评论(0) 推荐(0) 编辑
摘要: 给定大量手机用户通话记录,找出其中通话次数最多的聊天狂人。 输入格式: 输入首先给出正整数N(≤),为通话记录条数。随后N行,每行给出一条通话记录。简单起见,这里只列出拨出方和接收方的11位数字构成的手机号码,其中以空格分隔。 输出格式: 在一行中给出聊天狂人的手机号码及其通话次数,其间以空格分隔。 阅读全文
posted @ 2019-05-29 21:10 王清河 阅读(251) 评论(0) 推荐(0) 编辑
摘要: The task of this problem is simple: insert a sequence of distinct positive integers into a hash table, and output the positions of the input numbers. 阅读全文
posted @ 2019-05-29 21:10 王清河 阅读(364) 评论(0) 推荐(0) 编辑
摘要: The ranklist of PAT is generated from the status list, which shows the scores of the submissions. This time you are supposed to generate the ranklist 阅读全文
posted @ 2019-05-29 21:03 王清河 阅读(239) 评论(0) 推荐(0) 编辑
摘要: Given any permutation of the numbers {0, 1, 2,..., N−1}, it is easy to sort them in increasing order. But what if Swap(0, *) is the ONLY operation tha 阅读全文
posted @ 2019-05-29 21:03 王清河 阅读(317) 评论(0) 推荐(0) 编辑
摘要: 给定公司N名员工的工龄,要求按工龄增序输出每个工龄段有多少员工。 输入格式: 输入首先给出正整数N(≤),即员工总人数;随后给出N个整数,即每个员工的工龄,范围在[0, 50]。 输出格式: 按工龄的递增顺序输出每个工龄的员工个数,格式为:“工龄:人数”。每项占一行。如果人数为0则不输出该项。 输入 阅读全文
posted @ 2019-05-29 21:02 王清河 阅读(412) 评论(0) 推荐(0) 编辑