青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

隨筆 - 6, 文章 - 0, 評論 - 24, 引用 - 0
數據加載中……

Trie在程序設計競賽中的應用

Trie在程序設計競賽中的應用

題目

 Message Flood
Problem 

Well, how do you feel about mobile phone? Your answer would probably be something like that “It’s so convenient and benefits people a lot”. However, if you ask Merlin this question on the New Year’s Eve, he will definitely answer “What a trouble! I have to keep my fingers moving on the phone the whole night, because I have so many greeting messages to send! ”. Yes, Merlin has such a long name list of his friends, and he would like to send a greeting message to each of them. What’s worse, Merlin has another long name list of senders that have sent message to him, and he doesn’t want to send another message to bother them (Merlin is so polite that he always replies each message he receives immediately). So, before he begins to send messages, he needs to figure to how many friends are left to be sent. Please write a program to help him. 

Here is something that you should note. First, Merlin’s friend list is not ordered, and each name is alphabetic strings and case insensitive. These names are guaranteed to be not duplicated. Second, some senders may send more than one message to Merlin, therefore the sender list may be duplicated. Third, Merlin is known by so many people, that’s why some message senders are even not included in his friend list.

Input

There are multiple test cases. In each case, at the first line there are two numbers n and m (1<=n, m<=20000), which is the number of friends and the number of messages he has received. And then there are n lines of alphabetic strings (the length of each will be less than 10), indicating the names of Merlin’s friends, one per line. After that there are m lines of alphabetic strings, which are the names of message senders.

 The input is terminated by n=0. 

Output

For each case, print one integer in one line which indicates the number of left friends he must send. 

Sample Input
5 3
Inkfish
Henry
Carp
Max
Jericho
Carp
Max
Carp
0
Sample Output
3


代碼

 1#include <iostream>
 2#include <string>
 3#include "trie.h"
 4
 5struct Index {
 6    int operator[](char ch) {
 7        if (isupper(ch)) return ch - 'A';
 8        return ch - 'a';
 9    }

10}
;
11
12int n, m;
13std::string name;
14trie<26, Index> name_set;
15
16int main() {
17    while (std::cin>>n>>&& n) {
18        name_set.clear();
19        for (int i = 0; i < n; ++i) {
20            std::cin>>name;
21            name_set.insert(name.begin(), name.end());
22        }

23        int count = 0;
24        while (m--{
25            std::cin>>name;
26            count += name_set.erase(name.begin(), name.end());
27        }

28        printf("%d\n", n - count);
29    }

30}

31


測試數據

輸入數據
輸出數據

參考資料
郭嵩山、張子臻、王磊、湯振東著  國際大學生程序設計競賽例題解(五)  電子工業出版社

posted on 2009-03-28 11:45 yuyang7 閱讀(1724) 評論(0)  編輯 收藏 引用 所屬分類: 程序設計競賽

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            午夜精品免费| 欧美在线一区二区| 久久久久久穴| 久久9热精品视频| 午夜精品久久久久99热蜜桃导演| 亚洲乱码国产乱码精品精 | 欧美www视频在线观看| 老鸭窝亚洲一区二区三区| 久久综合久久美利坚合众国| 蜜桃av综合| 国产精品啊啊啊| 国产视频一区在线观看| 在线观看视频一区二区| 亚洲精品久久在线| 亚洲视频在线看| 久久精品成人一区二区三区蜜臀| 久久综合婷婷| 亚洲日本电影| 国产精品久久久久久久久久直播 | 日韩一级黄色大片| 亚洲欧美日韩一区在线| 久久夜色精品| 亚洲国产成人在线播放| 亚洲手机成人高清视频| 久久精品一区二区三区不卡牛牛| 欧美精品久久久久久久| 国产日韩欧美中文在线播放| 亚洲精品乱码久久久久久久久| 亚洲欧美日韩国产一区| 亚洲高清视频的网址| 欧美在线亚洲一区| 国产精品久久久久久久9999| 亚洲欧洲偷拍精品| 可以免费看不卡的av网站| 一区二区三区日韩| 免费精品99久久国产综合精品| 国产视频在线观看一区| 亚洲小说春色综合另类电影| 免费久久99精品国产自| 欧美一级艳片视频免费观看| 欧美日韩在线视频一区| 亚洲精品在线三区| 农村妇女精品| 久久久亚洲欧洲日产国码αv | 免费高清在线视频一区·| 国产区在线观看成人精品| 亚洲一区二区三区免费视频| 亚洲国产精品v| 久热精品视频在线观看一区| 激情一区二区三区| 久久久久久亚洲精品中文字幕| 在线亚洲+欧美+日本专区| 欧美日韩国产二区| 亚洲少妇诱惑| 夜夜夜久久久| 欧美亚洲成人免费| 亚洲综合日韩在线| 夜夜嗨av一区二区三区四区| 欧美日韩国产成人| 亚洲午夜精品网| 一区二区三区精密机械公司 | 宅男噜噜噜66一区二区| 欧美日韩亚洲一区二| 一区二区三区国产精品| 亚洲精选91| 国产精品白丝jk黑袜喷水| 久久久999精品视频| 日韩天天综合| 亚洲美女色禁图| 欧美吻胸吃奶大尺度电影| 亚洲性感美女99在线| 亚洲午夜日本在线观看| 国产女优一区| 看欧美日韩国产| 欧美成人自拍视频| 一区二区三区欧美视频| 一区二区三区黄色| 国产伦理一区| 久久久久亚洲综合| 欧美一区二视频| 在线观看的日韩av| 亚洲人www| 国产女主播一区二区| 久久免费精品视频| 欧美二区在线观看| 亚洲欧美日韩一区在线| 久久蜜桃资源一区二区老牛 | 久久精品视频99| 久久综合国产精品台湾中文娱乐网| 亚洲美女视频| 羞羞答答国产精品www一本 | 欧美一进一出视频| 久久精品噜噜噜成人av农村| 亚洲精品久久久久久久久久久| 一区二区三区四区五区在线| 伊人久久亚洲影院| 在线视频亚洲| 亚洲国产高清视频| 亚洲自拍都市欧美小说| 亚洲激情社区| 欧美亚洲系列| 一区二区三区精品视频在线观看| 欧美有码在线视频| 亚洲一区影院| 欧美精品国产一区二区| 久久久久久网| 国产精品狼人久久影院观看方式| 亚洲第一中文字幕| 一区二区亚洲精品国产| 亚洲欧美精品一区| 亚洲蜜桃精久久久久久久| 久久黄色小说| 久久福利资源站| 欧美日韩一区免费| 亚洲高清在线| 狠狠综合久久av一区二区小说| 99精品久久久| 一区二区三区www| 欧美黑人国产人伦爽爽爽| 久久性天堂网| 国产老肥熟一区二区三区| 一个色综合av| 亚洲精品乱码久久久久久蜜桃91| 久久精品一本| 久久资源av| 一区二区在线观看视频在线观看| 性久久久久久| 久久久久综合网| 国产精品综合| 日韩一级精品| 亚洲欧美欧美一区二区三区| 亚洲天堂男人| 欧美涩涩视频| 99精品久久| 中文精品一区二区三区| 欧美日韩不卡在线| 亚洲人成人一区二区三区| 亚洲青涩在线| 欧美日韩国产成人| 亚洲网友自拍| 久久精品国产欧美亚洲人人爽| 国产日本欧美视频| 久久电影一区| 欧美黄色网络| 一本色道久久88精品综合| 欧美日韩午夜激情| 99av国产精品欲麻豆| 亚洲欧美精品在线| 国产女主播一区二区| 久久精品视频播放| 欧美不卡在线视频| 99精品视频免费全部在线| 欧美日韩免费观看一区二区三区| 亚洲最快最全在线视频| 欧美一区二区久久久| 在线观看日韩一区| 欧美日本亚洲韩国国产| 中文在线不卡| 久久影院午夜片一区| 亚洲精品国产无天堂网2021| 国产精品超碰97尤物18| 久久国产日韩欧美| 亚洲肉体裸体xxxx137| 亚洲性视频网站| 国产一区二区三区网站 | 两个人的视频www国产精品| 亚洲成人在线视频播放| 欧美激情综合色| 亚洲一区二区动漫| 免费久久久一本精品久久区| 一本在线高清不卡dvd| 国产日韩欧美二区| 欧美激情在线观看| 亚洲调教视频在线观看| 欧美不卡高清| 久久高清免费观看| 一本色道久久88综合日韩精品| 国产婷婷精品| 欧美区视频在线观看| 欧美综合77777色婷婷| 亚洲美女中文字幕| 免费在线亚洲欧美| 欧美中文字幕视频| 一区二区三区久久网| 激情欧美国产欧美| 国产精品久久久久一区二区三区| 毛片一区二区三区| 午夜在线a亚洲v天堂网2018| 亚洲国产精选| 免费日本视频一区| 欧美影视一区| 亚洲综合激情| 宅男精品视频| 亚洲免费成人av| 亚洲日本国产| 欧美日本免费| 欧美成人免费全部| 久久免费黄色| 久久精品国产亚洲一区二区三区| 一区二区三区高清不卡|