Message Flood --set相关操作

Message Flood

Time Limit: 1500ms   Memory limit: 65536K  有疑问?点这里^_^

题目描述

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 message 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 message, 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.

输入

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.

输出

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

示例输入

5 3
Inkfish
Henry
Carp
Max
Jericho
Carp
Max
Carp
0

示例输出

3

来源

第9届中山大学程序设计竞赛预选赛

是一道字典树的题,额 目前还不会敲字典树 先用set搞搞

翻译一下:输入一个邮件好友列表(无重复名称) 再输入一个邮件发送列表(可能有重复),且这两个列表里的好友名字都不区分大小写(坑) 求未发送邮件好友的数目

Message Flood --set相关操作

时间: 2024-11-06 16:41:45

Message Flood --set相关操作的相关文章

二叉树的相关操作

#include<stdio.h> #include<malloc.h> #define MAXSIZE 20 typedef char TEelemtype; typedef struct BiTNode{ TEelemtype data; struct BiTNode *lchild,*rchild; }BiTNode,*BiTree; //队列的方式 typedef struct queueelem { BiTNode* b[MAXSIZE]; int front,rear;

(二十四)linux新定时器:timefd及相关操作函数

timerfd是Linux为用户程序提供的一个定时器接口.这个接口基于文件描述符,通过文件描述符的可读事件进行超时通知,所以能够被用于select/poll的应用场景. 一,相关操作函数 #include <sys/timerfd.h> int timerfd_create(int clockid, int flags); int timerfd_settime(int fd, int flags, const struct itimerspec *new_value, struct itim

二叉树各种相关操作(建立二叉树、前序、中序、后序、求二叉树的深度、查找二叉树节点,层次遍历二叉树等)(C语言版)

将二叉树相关的操作集中在一个实例里,有助于理解有关二叉树的相关操作: 1.定义树的结构体: 1 typedef struct TreeNode{ 2 int data; 3 struct TreeNode *left; 4 struct TreeNode *right; 5 }TreeNode; 2.创建根节点: 1 TreeNode *creatRoot(){ 2 TreeNode * root =(TreeNode *)malloc(sizeof(TreeNode)); 3 if(NULL=

linux下进程相关操作

一.定义和理解 狭义定义:进程是正在运行的程序的实例. 广义定义:进程是一个具有一定独立功能的程序关于某个数据集合的一次运行活动. 进程的概念主要有两点: 第一,进程是一个实体.每一个进程都有它自己的地址空间,一般情况下,包括文本区域.数据区域和堆栈区域.文本区域存储处理器执行的代码:数据区域存储变量和进程执行期间使用的动态分配的内存:堆栈区域存储着活动过程调用的指令和本地变量. 第二,进程是一个“执行中的程序”.程序是一个没有生命的实体,只有处理器赋予程序生命时,它才能成为一个活动的实体,我们

android DataBase的相关操作(建立表结构和创建表)

先建立一个table的基类: public abstract class DbBaseTable { private static final String TAG = "DbBaseTable"; /** * @return the DB table name */ abstract String getName(); /** * Creates the DB table according to the DB scheme * * @param db */ abstract voi

WebView中的视频全屏的相关操作

最近工作中,基本一直在用WebView,今天就把它整理下: WebView 顾名思义,就是放一个网页,一个看起来十分简单,但是用起来不是那么简单的控件. 首先你肯定要定义,初始化一个webview,其实网上的例子很多,我这里就简单的把一些WebView 中可能会用到的的很重要的属性以及支持全屏播放视频该怎么实现的代码粘出来,直接放到项目中去就行了 <span style="white-space:pre"></span><pre name="co

jQuery学习笔记--JqGrid相关操作 方法列表(上)

1.获得当前列表行数:$("#gridid").getGridParam("reccount"); 2.获取选中行数据(json):$("#gridid").jqGrid('getRowData', id); 3.刷新列表:$(refreshSelector).jqGrid('setGridParam', { url: ''), postData: ''}).trigger('reloadGrid'); 4.选中行:$("#jqGrid

JQuery select控件的相关操作

本文转载于 http://www.cnblogs.com/zfc2201/archive/2012/09/06/2674312.html JQuery获取和设置Select选项方法汇总如下: 获取select 先看看下面代码: $("#select_id").change(function(){//code...}); //为Select添加事件,当选择其中一项时触发 var checkText=$("#select_id").find("option:s

python文件相关操作

Python文件相关操作 打开文件 打开文件,采用open方法,会将文件的句柄返回,如下: f = open('test_file.txt','r',encoding='utf-8') 在上面的代码中,open()方法进行打开文件等相关操作,open()方法其中第一个参数是要打开的文件的文件路径,第二个参数是对要打开文件要执行的权限,第三个参数是文件采用字符编码. 而open()方法返回的内容叫做文件句柄.我们可以打印返回的文件句柄来看下: f = open('test_file.txt','r