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