[51nod1095] Anigram word (map)

Source: Internet
Author: User

Title Link: http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1095

Dictionary words are sorted in map and are not sorted 1 times, subtract when checking.

1#include <bits/stdc++.h>2 using namespacestd;3 4 Const intMAXN =10100;5 intN, Q;6 Chartmp[ A];7map<string,int>D1;8map<string,int>D2;9 Ten intMain () { One   //freopen ("in", "R", stdin); A    while(~SCANF ("%d",&N)) { - d1.clear (); D2.clear (); -      for(inti =0; I < n; i++) { thescanf"%s", TMP); -d1[tmp]++; -Sort (tmp, tmp+strlen (TMP)); -d2[tmp]++; +     } -scanf"%d",&q); +      while(q--) { Ascanf"%s", TMP); at       intA =d1[tmp]; -Sort (tmp, tmp+strlen (TMP)); -       intb =d2[tmp]; -printf"%d\n", B-a); -     } -   } in   return 0; -}

[51nod1095] Anigram word (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.