A. Transmigration
A. Transmigration
2 seconds
256 megabytes
standard input
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 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 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的更多相关文章
- Codeforces Beta Round #81 A Transmigration
在魔界战记中有一个设定叫做转生,当一个人物转生时,会保留之前的技能,但是技能等级需要乘以一个系数 k ,如果技能等级小于100,将会在转生之后失去该技能. 转生之后,会学到一些新技能.这些新技能附加的 ...
- CODEFORCES problem 105A.Transmigration
题目本身上手并不难,字符串处理+简单的排序.要注意的地方是浮点数的处理. 依据计算机中浮点数的表示原理,在实际编程的过程中即使用一个确定的整数(假设是1)给一个浮点变量赋值 在查看变量时会发现实际存储 ...
- [Reship]如何回复审稿人意见
================================= This article came from here:http://blog.renren.com/GetEntry.do?id= ...
- python瓦登尔湖词频统计
#瓦登尔湖词频统计: import string path = 'D:/python3/Walden.txt' with open(path,'r',encoding= 'utf-8') as tex ...
随机推荐
- 草地排水 洛谷P2740 最大流 入门题目
草地排水 洛谷P2740 最大流入门题目 题意 在农夫约翰的农场上,每逢下雨,贝茜最喜欢的三叶草地就积聚了一潭水.这意味着草地被水淹没了,并且小草要继续生长还要花相当长一段时间.因此,农夫约翰修建了一 ...
- GDOI2018游记
前言 不知怎的,本蒟蒻居然拿到了GDOI参赛名额 于是乎,我稀里糊涂地跟着诸位大佬屁颠屁颠地来到了阔别已久的中山一中 腐败difficult and interesting的GDOI比赛就这样开始了. ...
- [BZOJ2594] [WC2006]水管局长(Kruskal+LCT)
[BZOJ2594] [WC2006]水管局长(Kruskal+LCT) 题面 SC省MY市有着庞大的地下水管网络,嘟嘟是MY市的水管局长(就是管水管的啦),嘟嘟作为水管局长的工作就是:每天供水公司可 ...
- 通过PlayBook部署Zabbix
编写Linux初始化剧本 初始化剧本环节,主要用户实现关闭Selinux关闭防火墙,一起配置一下阿里云的YUM源地址,和安装EPEL源,为后期的zabbix安装做好铺垫工作. 1.在安装Zabbix之 ...
- (转载)sublime3安装markdown插件
原文链接 http://www.jianshu.com/p/335b7d1be39e?utm_source=tuicool&utm_medium=referral 最近升级到了 Sublime ...
- delegate作为操作符的使用
lambda表达式的出现基本上取代了delegate操作符的使用 public MainWindow() { InitializeComponent(); this.button1.Click += ...
- Mac下的Web性能压力测试工具:ab(ApacheBench)
Web开发,少不了的就是压力测试,它是评估一个产品是否合格上线的基本标准. ab是一种用于测试Apache超文本传输协议(HTTP)服务器的工具.apache自带ab工具,可以测试Apache.IIS ...
- java实现spark常用算子之filter
import org.apache.spark.SparkConf;import org.apache.spark.api.java.JavaRDD;import org.apache.spark.a ...
- 应对Hadoop集群数据疯长,这里祭出了4个治理对策!
一.背景 在目前规模比较大的互联网公司中,总数据量能达到10PB甚至几十PB数据量的公司,我认为中国已经有超过了20家了.而在这些公司中,也有很多家公司的 日数据增长达到100TB+ 了. 所以我们每 ...
- 计算机网络:这是一份全面 & 详细 的TCP协议学习指南
原文链接:blog.csdn.net 用这个媒体播放器组件,实时互动时也可共同观看本地视频juejin.im 前言 计算机网络基础 该是程序猿需掌握的知识,但往往会被忽略 今天,我将详细讲解计算机网络 ...