HDU 5688 Problem D Map

Source: Internet
Author: User

Problem D

Time limit:2000/1000 MS (java/others) Memory limit:65536/65536 K (java/others)
Total submission (s): 394 Accepted Submission (s): 273

problem DescriptionThe D country where bears live is a country full of respect for human rights. It is so strange that all the people in this country name their names. A person's name is made up of several characters, and the same is true of each string in the result of the full arrangement of these characters. For example, if a person's name is ACM, then AMC, CAM, MAC, MCA, etc. are also the names of this person. In this country, there are not two people with the same name.

Degree bears want to count the number of people in this country, help a bear to design a program that counts how many times each person has been counted before. InputThis includes a set of test data, the first line contains a positive integer n, and the next n rows represent n names. N will not exceed 100,000, their name will not exceed 40 bits. OutputFor each name entered, output an integer representing how many times the person was counted. Sample Input5ACMMACBBAACMBAB Sample Output01021 Source2016 "Baidu Star"-Qualifying race (Astar Round1) Test Instructions: Number of occurrences of the statistic string before this idea: Simple map, the same string order as the same string, can be sorted by the sort function

#include <stdio.h>#include<map>#include<string.h>#include<algorithm>using namespacestd;intMain () {intT;Chara[ -];map<string,int>one;scanf ("%d", &t); while(t--) {scanf ("%s", a); Sort (A,a+strlen (a)); printf ("%d\n", one[a]++);}return 0;}

HDU 5688 Problem D Map

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.