题意:给出n个名字变化,问一个名字最后变成了什么名字 先用map顺着做的,后来不对, 发现别人是将变化后的那个名字当成键值来做的,最后输出的时候先输出second,再输出first 写一下样例就好理解了 #include<iostream> #include<cstdio> #include<cstring> #include <cmath> #include<stack> #include<vector> #include<m…
Misha and Changing Handles CodeForces原题是英文,这里就直接上中文好了,翻译不是太给力,但是不影响做题 ^▽^ Description  神秘的三角洲里还有一个传说中的谜题等你来解开!三角洲里的小学生小明是个小天才,知天文晓地理还能夜观星象算命,好多疯狂的小朋友都想去请他给自己换个好听的名字.但是天才小明,他总是在思考31维宇宙空间的奥秘,神游天外,所以在给小朋友们敲他们想要的名字的时候,偶尔会取出一些不那么完美的名字.有的小朋友们换了名字以后不太满意,于是它…
题目传送门 /* 题意:给出一系列名字变化,问最后初始的名字变成了什么 字符串处理:每一次输入到之前的找相印的名字,若没有,则是初始的,pos[m] 数组记录初始位置 在每一次更新时都把初始pos加上去,那么就保证更新了初始的名字,这也是唯一要思考的地方了:) */ #include <cstdio> #include <iostream> #include <cstring> #include <algorithm> #include <cmath&…
Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point…
B. Misha and Changing Handles time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now cha…
目录:1.潜伏者 [map] 2.Hankson的趣味题[数论]3.mayan游戏[dfs] 题目: 1. 潜伏者(spy.pas/c/cpp)[问题描述]R 国和S 国正陷入战火之中,双方都互派间谍,潜入对方内部,伺机行动.历经艰险后,潜伏于S 国的R 国间谍小C 终于摸清了S 国军用密码的编码规则:1. S 国军方内部欲发送的原信息经过加密后在网络上发送,原信息的内容与加密后所的内容均由大写字母‘A’—‘Z’构成(无空格等其他字母).2. S 国对于每个字母规定了对应的“密字”.加密的过程就…
day04 [Map] 主要内容 Map集合 教学目标 能够说出Map集合特点 使用Map集合添加方法保存数据 使用”键找值”的方式遍历Map集合 使用”键值对”的方式遍历Map集合 能够使用HashMap存储自定义键值对的数据 第一章 Map集合 1.1 概述 现实生活中,我们常会看到这样的一种集合:IP地址与主机名,身份证号与个人,系统用户名与系统用户对象等,这种一 一对应的关系,就叫做映射.Java提供了专门的集合类用来存放这种k-v关系的对象,即java.util.Map接口. 我们通过…
A. Greed time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Jafar has n cans of cola. Each can is described by two integers: remaining volume of cola ai and can's capacity bi (ai  ≤  bi). Jaf…
A. Arya and Bran time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Bran and his older sister Arya are from the same house. Bran like candies so much, so Arya is going to give him some Candies…
D. Restoration of string time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A substring of some string is called the most frequent, if the number of its occurrences is not less than number of…