Phone Chat Maniac

Source: Internet
Author: User

11-Hash 1 Phone chat maniac (25 min)

Given a large number of mobile phone users call logs, find the most calls in the chat madman.

Input format:

The input first gives a positive integerN (≤10? ) 5?? ) for the number of call logs. Then n lines, each row gives a call record. For simplicity, only the 11-digit mobile number of the dial-out party and the receiver is listed here, separated by a space.

Output format:

The phone number of the chat madman and the number of calls are given in a row, separated by a space. If such a person is not unique, then output the smallest number in the madman and its number of calls, and attach to the number of people who are tied to the madman.

Input Sample:
413005711862 1358862583213505711862 1308862583213588625832 1808792583215005713862 13588625832
Sample output:
13588625832 3

#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #define Keylength 13#define maxtablesize 100001typedef char elementtype[keylength];typedef int index;typedef struct lnode* ptrtolnode; struct Lnode{elementtype data;int cnt; Ptrtolnode Next;}; typedef ptrtolnode POSITION;TYPEDEF ptrtolnode list;typedef struct Tblnode *hashtable;struct tblnode {int TableSize; List Heads;}; HashTable createtable (int tablesize); Position Find (HashTable H, ElementType key); Index Hash (ElementType Key, int tablesize); int nextprime (int N); void Ins ERT (HashTable H, ElementType Key), void Scanandoutput (HashTable h); void destroytable (HashTable h); int main () {//freope N ("C:\\in.txt", "R", stdin), int N, i;scanf ("%d", &n); HashTable H; ElementType Key; h = createtable (n*2); for (i=0; i<n*2; i++) {scanf ("%s", key); Insert (H, key);} Scanandoutput (h);D estroytable (h); return 0;} void Destroytable (HashTable H) {int i; Position P, Tmp;for (i=0; i

  

 

Phone Chat Maniac

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.