CF105A.Transmigration

普及+/提高

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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?

在《魔界战记》(Disgaea)以及大多数角色扮演游戏中,角色拥有技能,这些技能决定了角色能否使用特定的武器或法术。如果角色不具备所需的技能,则无法使用它。技能等级以整数表示,每次使用该技能时等级便会提升。不同的角色职业对应着不同的技能。

遗憾的是,对于给定角色职业而言不常见的技能往往极难获得。为避免这一限制,游戏中引入了所谓的“转生”(transmigration)机制。

转生是指角色以新生物形态进行轮回重生。其灵魂转移到新的躯体中,并保留前一世的部分经验。

转生后,新角色将继承原角色的所有技能,但各项技能等级会按系数 kk 进行缩减(若原技能等级为 xx,则转生后变为 ⌊kx⌋\lfloor kx \rfloor,其中 ⌊y⌋\lfloor y \rfloor 表示 yy 的向下取整)。若某项技能的等级严格小于 100,则该技能将被遗忘(即角色不再拥有此项技能)。此后,新角色还会获得其所属职业特有、但此前尚未掌握的技能;这些新增技能的等级均设为 0。

因此,通过多次转生,玩家可以创造出具备完全不同职业专属技能的角色。例如,可打造一名兼具法师职业与弓箭手职业特性的“法师弓箭手”,或是一名兼具盗贼职业与战士职业特性的“盗贼战士”。

现请你解决如下问题:角色转生后将拥有哪些技能?各项技能的等级又分别为多少?

输入格式

The first line contains three numbers n, m 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 20 characters, inclusive. All character's skills have distinct names. Besides the skills specific for the class into which the player transmigrates also have distinct names.

第一行包含三个数 nn、mm 和 kk —— 分别表示当前角色所拥有的技能数量、该角色即将转职的目标职业所特有的技能数量,以及衰减系数;其中 nn 和 mm 为整数,kk 是一个保留两位小数的实数(1≤n,m≤201 \leq n, m \leq 20,0.01≤k≤0.990.01 \leq k \leq 0.99)。

接下来是 nn 行,每行以“name exp”的形式描述一个角色的技能——即技能名称与角色在该技能上的等级:name 是一个字符串,exp 是一个介于 00 到 99999999(含端点)之间的整数。

随后是 mm 行,每行包含一个字符串,表示该角色将要转职的目标职业所特有的某项技能的名称。

所有名称均由小写拉丁字母组成,且长度均为 11 至 2020 个字符(含端点)。角色所拥有的各项技能名称互不相同;此外,目标职业所特有的各项技能名称也互不相同。

输出格式

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.

第一行输出整数 z —— 角色转生后所拥有的技能数量。随后输出 z 行,每行输出一个技能的名称及其等级,二者之间用一个空格分隔。技能应按字典序排列。

输入输出样例

  • 输入#1

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

    输出#1

    6
    axe 262
    heal 0
    impaler 225
    magicboost 165
    megafire 0
    shield 0

输入解题思路,AI测评打分。不知道怎么写?

首页