《ACM程序设计》书中题目 H-08 火星ACM
来源:互联网 发布:武汉大学法学院 知乎 编辑:程序博客网 时间:2024/06/11 22:21
Description
In the 22nd Century, scientists have discovered intelligent residents live on the Mars. Martians are very fond of mathematics. Every year, they would hold an Arithmetic Contest on Mars (ACM). The task of the contest is to calculate the sum of two 100-digit numbers, and the winner is the one who uses least time. This year they also invite people on Earth to join the contest.
As the only delegate of Earth, you're sent to Mars to demonstrate the power of mankind. Fortunately you have taken your laptop computer with you which can help you do the job quickly. Now the remaining problem is only to write a short program to calculate the sum of 2 given numbers. However, before you begin to program, you remember that the Martians use a 20-based number system as they usually have 20 fingers.
Input:
You're given several pairs of Martian numbers, each number on a line.
Martian number consists of digits from 0 to 9, and lower case letters from a to j (lower case letters starting from a to present 10, 11, ..., 19).
The length of the given number is never greater than 100.
Output:
For each pair of numbers, write the sum of the 2 numbers in a single line.
Sample Input:
1234567890abcdefghij99999jjjjj9999900001
Sample Output:
bdfi02467jiiiij00000
这道题的基本题意为求两个不超过100位的数之和,与平常不同的是这些数采取的20进制,难点就在于10进制与20进制的转换。
源代码如下:
- 《ACM程序设计》书中题目 H-08 火星ACM
- 《ACM程序设计》书中题目--problem h
- 《ACM程序设计》书中题目H
- 关于acm程序设计书中题目 #H 第8题
- ACM书中题目 H
- 《ACM程序设计》书中题目
- ACM程序设计书上题目H
- 《ACM程序设计》书中题目--problem j
- 《ACM程序设计》书中题目 J
- 《ACM程序设计》书中题目O-15
- 《ACM程序设计》书中题目M-13
- 《ACM程序设计》书中题目--problem o
- 《ACM程序设计》书中题目--problem u
- 《ACM程序设计》书中题目―K
- 《ACM程序设计》书中题目 U
- 《ACM程序设计》书中题目 N
- 《ACM程序设计》书中题目 T
- 《ACM程序设计》书中题目 K
- 队列(内核为单链表).c
- 凯撒密码改进版本
- 文字动画
- Python向mysql数据库插入数据
- 【Android 基础】数据存储SharedPreferences 使用
- 《ACM程序设计》书中题目 H-08 火星ACM
- 全文本搜索 (For MySQL)
- LintCode | 569. Add Digits
- 面试常考的常用数据结构与算法
- js高级程序设计笔记 -- 属性类型以及创建对象
- java设计模式之单例模式、工厂模式
- 排序-冒泡排序
- 如何用好项目管理工具
- Python爬虫豆瓣电影top250