摘要: Given a hash table of size N, we can define a hash function H(x)=x%N. Suppose that the linear probing is used to solve collisions, we can easily obtai 阅读全文
posted @ 2021-05-26 23:13 keiiha 阅读(187) 评论(0) 推荐(0) 编辑
摘要: 实现QQ新帐户申请和老帐户登陆的简化版功能。最大挑战是:据说现在的QQ号码已经有10位数了。 输入格式: 输入首先给出一个正整数N(≤10​5​​),随后给出N行指令。每行指令的格式为:“命令符(空格)QQ号码(空格)密码”。其中命令符为“N”(代表New)时表示要新申请一个QQ号,后面是新帐户的号 阅读全文
posted @ 2021-05-26 21:47 keiiha 阅读(154) 评论(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 @ 2021-05-26 21:31 keiiha 阅读(69) 评论(0) 推荐(0) 编辑
摘要: 给定大量手机用户通话记录,找出其中通话次数最多的聊天狂人。 输入格式: 输入首先给出正整数N(≤10​5​​),为通话记录条数。随后N行,每行给出一条通话记录。简单起见,这里只列出拨出方和接收方的11位数字构成的手机号码,其中以空格分隔。 输出格式: 在一行中给出聊天狂人的手机号码及其通话次数,其间 阅读全文
posted @ 2021-05-26 15:15 keiiha 阅读(59) 评论(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 @ 2021-05-26 14:49 keiiha 阅读(74) 评论(0) 推荐(0) 编辑
摘要: 给定公司N名员工的工龄,要求按工龄增序输出每个工龄段有多少员工。 输入格式: 输入首先给出正整数N(≤10​5​​),即员工总人数;随后给出N个整数,即每个员工的工龄,范围在[0, 50]。 输出格式: 按工龄的递增顺序输出每个工龄的员工个数,格式为:“工龄:人数”。每项占一行。如果人数为0则不输出 阅读全文
posted @ 2021-05-26 13:25 keiiha 阅读(100) 评论(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 @ 2021-05-26 11:46 keiiha 阅读(100) 评论(0) 推荐(0) 编辑
摘要: According to Wikipedia: Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insert 阅读全文
posted @ 2021-05-26 01:44 keiiha 阅读(81) 评论(0) 推荐(0) 编辑