A. Transmigration

time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

In Disgaea as in most role-playing games, characters have skills that determine the character's ability to use certain weapons or spells. If the character does not have the necessary skill, he cannot use it. The skill level is represented as an integer that increases when you use this skill. Different character classes are characterized by different skills.

Unfortunately, the skills that are uncommon for the given character's class are quite difficult to obtain. To avoid this limitation, there is the so-called transmigration.

Transmigration is reincarnation of the character in a new creature. His soul shifts to a new body and retains part of his experience from the previous life.

As a result of transmigration the new character gets all the skills of the old character and the skill levels are reduced according to the k coefficient (if the skill level was equal to x, then after transmigration it becomes equal to [kx], where [y] is the integral part of y). If some skill's levels are strictly less than 100, these skills are forgotten (the character does not have them any more). After that the new character also gains the skills that are specific for his class, but are new to him. The levels of those additional skills are set to 0.

Thus, one can create a character with skills specific for completely different character classes via transmigrations. For example, creating a mage archer or a thief warrior is possible.

You are suggested to solve the following problem: what skills will the character have after transmigration and what will the levels of those skills be?

Input

The first line contains three numbers nm and k — the number of skills the current character has, the number of skills specific for the class into which the character is going to transmigrate and the reducing coefficient respectively; n and m are integers, and k is a real number with exactly two digits after decimal point (1 ≤ n, m ≤ 20, 0.01 ≤ k ≤ 0.99).

Then follow n lines, each of which describes a character's skill in the form "name exp" — the skill's name and the character's skill level: name is a string and exp is an integer in range from 0 to 9999, inclusive.

Then follow m lines each of which contains names of skills specific for the class, into which the character transmigrates.

All names consist of lowercase Latin letters and their lengths can range from 1 to 20characters, inclusive. All character's skills have distinct names. Besides the skills specific for the class into which the player transmigrates also have distinct names.

Output

Print on the first line number z — the number of skills the character will have after the transmigration. Then print z lines, on each of which print a skill's name and level, separated by a single space. The skills should be given in the lexicographical order.

Examples

input

5 4 0.75
axe 350
impaler 300
ionize 80
megafire 120
magicboost 220
heal
megafire
shield
magicboost

output

6
axe 262
heal 0
impaler 225
magicboost 165
megafire 0
shield 0 题意:玩过DNF的人都知道,每个角色到了18级就可以转职,换成一个新的职业,有新的技能。而这个题的意思是在未转职之前的技能点数大于或者等于100的,可以保留下来。而转职之后获得新的技能,如果那个技能在之前已经有点数了(这个点数必定是大于或等于100),那就不需要进行操作,如果没有的话,就将该技能点数赋值为0。本题有一个问题,就是会卡你精度,我就是因为这个测试数据19总是过不了,其他的就没什么注意的了。
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<map> #define eps 1e-6 using namespace std; map<string,int> mp; int main()
{
int n,m;
double k;
cin>>n>>m>>k;
string name;
int exp;
for(int i=;i<n;i++)
{
cin>>name>>exp;
exp=exp*k+eps; //注意:这里是卡精度,要加上行1e-6才能过
if(exp>=) //判断是否大于或等于100
mp[name]=exp;
}
for(int i=;i<m;i++)
{
cin>>name;
if(mp[name]==)
mp[name]=;
}
cout<<mp.size()<<endl;
for(map<string,int>::iterator it=mp.begin();it!=mp.end();it++) //map容器里是按字典序存放的
cout<<it->first<<" "<<it->second<<endl;
return ;
}

A. Transmigration的更多相关文章

  1. Codeforces Beta Round #81 A Transmigration

    在魔界战记中有一个设定叫做转生,当一个人物转生时,会保留之前的技能,但是技能等级需要乘以一个系数 k ,如果技能等级小于100,将会在转生之后失去该技能. 转生之后,会学到一些新技能.这些新技能附加的 ...

  2. CODEFORCES problem 105A.Transmigration

    题目本身上手并不难,字符串处理+简单的排序.要注意的地方是浮点数的处理. 依据计算机中浮点数的表示原理,在实际编程的过程中即使用一个确定的整数(假设是1)给一个浮点变量赋值 在查看变量时会发现实际存储 ...

  3. [Reship]如何回复审稿人意见

    ================================= This article came from here:http://blog.renren.com/GetEntry.do?id= ...

  4. python瓦登尔湖词频统计

    #瓦登尔湖词频统计: import string path = 'D:/python3/Walden.txt' with open(path,'r',encoding= 'utf-8') as tex ...

随机推荐

  1. CVE-2018-19985漏洞学习

    简介 4.19.8之前,在Linux内核中,hso_probe()函数中发现了一个缺陷,该函数从USB设备(作为u8)读取if_num值,并且不需要对数组进行长度检查就使用它来索引数组,从而导致在hs ...

  2. expdp使用

    原文:https://blog.csdn.net/zftang/article/details/6387325 ORACLE EXPDP命令使用详细相关参数以及导出示例: 1. DIRECTORY指定 ...

  3. Linux 安装 python3.6 ,并且配置 Pycharm 远程连接开发

    Linux下安装Python3.6和第三方库   如果本机安装了python2,尽量不要管他,使用python3运行python脚本就好,因为可能有程序依赖目前的python2环境, 比如yum!!! ...

  4. [转载]java匿名对象

    来源:https://blog.csdn.net/qiaoquan3/article/details/53300248 匿名对象:没有名字的对象:new Car();  //匿名对象其实就是定义对象的 ...

  5. 在set中放入自定义类型

    这件事情的起因是在学习背包问题时突然想到了一种算法,分析了一下应该是n^2logn复杂度的,当然比dp慢.但是既然想到了就实现了下: #include<bits/stdc++.h> usi ...

  6. Object 对象(对象的分类、属性(属性名和属性值)、基本数据类型与引用数据类型区别)

    Object——引用数据类型 基本数据类型的不足之处:基本数据类型是单一的值,不能表现出值与值之间的所属关系 object分为内建对象.宿主对象和自定义对象 a 内建对象:ES标准中定义的对象,在任何 ...

  7. angular项目中ts的配置编译tsconfig.json

    { "compilerOptions": { /* 基本选项 */ "target": "es5", // 指定 ECMAScript 目标 ...

  8. electron builder 打包多个第三方依赖的软件

    背景 在实际的开发过程中,我们最后打包生成的exe.会依赖一些第三方的软件,或者说是一些系统的环境,比如 .net framework vc++ 等,这些环境不能依赖客户的环境,所以最好的做法是在打包 ...

  9. Tensorflowlite移植ARM平台iMX6

    一.LINUX环境下操作: 1.安装交叉编译SDK (仅针对该型号:i.MX6,不同芯片需要对应的交叉编译SDK) 编译方法参考:手动编译用于i.MX6系列的交叉编译SDK 2.下载Tensorflo ...

  10. 一、Nginx多站点配置

    一.下载 目录文件: 二.运行方式 (1)直接双击nginx.exe,双击后一个黑色的弹窗一闪而过 (2)打开cmd命令窗口,切换到nginx解压目录下,输入命令 nginx.exe 或者 start ...