Alien Numbers
来源:互联网 发布:2017dnf数据异常24小时 编辑:程序博客网 时间:2024/05/08 18:18
Alien Numbers
Time Limit:1000MS Memory Limit:65536K
Total Submit:45 Accepted:15
Description
The decimal numeral system is composed of ten digits, which we represent as "0123456789" (the digits in a system are written from lowest to highest). Imagine you have discovered an alien numeral system composed of some number of digits, which may or may not be the same as those used in decimal. For example, if the alien numeral system were represented as "oF8", then the numbers one through ten would be (F, 8, Fo, FF, F8, 8o, 8F, 88, Foo, FoF). We would like to be able to work with numbers in arbitrary alien systems. More generally, we want to be able to convert an arbitrary number that's written in one alien system into a second alien system.
Input
The first line of input gives the number of cases, N. N test cases follow. Each case is a line formatted as
alien_number source_language target_language
Each language will be represented by a list of its digits, ordered from lowest to highest value. No digit will be repeated in any representation, all digits in the alien number will be present in the source language, and the first digit of the alien number will not be the lowest valued digit of the source language (in other words, the alien numbers have no leading zeroes). Each digit will either be a number 0-9, an uppercase or lowercase letter, or one of the following symbols !"#$%&'()*+,-./:;<=>?@[/]^_`{|}~
1 ≤ N ≤ 100.
1 ≤ alien_number (in decimal) ≤ 1000000000,
2 ≤ num digits in source_language ≤ 94,
2 ≤ num digits in target_language ≤ 94.
Output
For each test case, output one line containing "Case #x: " followed by the alien number translated from the source language to the target language.
Sample Input
49 0123456789 oF8Foo oF8 012345678913 0123456789abcdef 01CODE O!CDE? A?JM!.
Sample Output
Case #1: FooCase #2: 9Case #3: 10011Case #4: JAM!
Source
很少用STL做题,这次用了下HASH,记录一下,以免忘记!
- Alien Numbers
- Alien Numbers
- Alien Numbers
- Alien Numbers
- Google CodeJam习题:Alien Numbers
- ACdream 1038 Alien Numbers (模拟)
- Google Code Jam之Alien Numbers之我的解答
- Alien Order
- Alien Dictionary
- Alien Dictionary
- Alien Dictionary
- Alien Security
- 外来物种 alien species
- [Code Jam] Alien Language
- POJ 1130 Alien Security
- poj 1130Alien Security
- A - Alien's Organ
- ZOJ-1085 Alien Security
- 入职2周感想
- 刷新数据
- RFC3410翻译
- pku 1298 The Hardest Problem Ever
- 数据库添加步骤(vb6.0)
- Alien Numbers
- 纵向选项卡代码
- 解决VS2005中fstream不能打开带有中文路径文件的问题
- 模仿新浪的纵向蓝色选项卡效果
- pku 1313 Booklet Printing
- 基于常见投票系统的作弊方法
- 学习中信息查询链接
- pku 1316 Self Numbers
- 窗体的拖动