1 背景
第5天的题目实在搞不定了,于是就参考了一下排名第一的大佬的代码
2 题目:Powerful Calculator
题目描述
Today, facing the rapid development of business, SJTU recognizes that more powerful calculator should be studied, developed and appeared in future market shortly. SJTU now invites you attending such amazing research and development work. In most business applications, the top three useful calculation operators are Addition (+), Subtraction (-) and Multiplication (×) between two given integers. Normally, you may think it is just a piece of cake. However, since some integers for calculation in business application may be very big, such as the GDP of the whole world, the calculator becomes harder to develop. For example, if we have two integers 20 000 000 000 000 000 and 4 000 000 000 000 000, the exact results of addition, subtraction and multiplication are: 20000000000000000 + 4000000000000000 = 24 000 000 000 000 000 20000000000000000 - 4000000000000000 = 16 000 000 000 000 000 20000000000000000 × 4000000000000000 = 80 000 000 000 000 000 000 000 000 000 000 Note: SJTU prefers the exact format of the results rather than the float format or scientific remark format. For instance, we need “24000000000000000” rather than 2.4×10^16. As a programmer in SJTU, your current task is to develop a program to obtain the exact results of the addition (a + b), subtraction (a - b) and multiplication (a × b) between two given integers a and b.
意思大致是:
今天,面对业务的快速发展,上海交通大学认识到,更强大的计算器应该研究,开发和出现在未来的市场很快。上海交通大学诚邀您参加如此精彩的研发工作。在大多数业务应用程序中,前三个有用的计算运算符是两个给定整数之间的加法(+)、减法(-)和乘法(×)。通常,你可能会认为这只是小菜一碟。然而,由于商业应用中计算的一些整数可能非常大,比如全球的GDP,使得计算器的开发变得更加困难。例如,如果我们有两个整数20 000 000 000和4 000 000 000 000 000,那么加、减、乘的精确结果是:200000000000+40000000000=24 000 000 000 000 000 000 000-40000000000=16 000 000 000 000 000 000 000×40000000000=8 000 000 000 000 000 000 000 000注:上海交通大学倾向于结果的精确格式,而不是浮点数格式或科学备注格式。例如,我们需要“24000000000000000”,而不是2.4×10^16。作为上海交通大学的程序员,您当前的任务是开发一个程序,以获得两个给定整数a和b之间的加法(a+b)、减法(a-b)和乘法(a×b)的精确结果。
输入描述:
Each case consists of two separate lines where the first line gives the integer a and the second gives b (|a| <10^400 and |b| < 10^400).
意思大致是:
每种情况由两行组成,第一行给出整数a,第二行给出b(| a |<10^400和| b |<10^400)。
输出描述:
For each case, output three separate lines showing the exact results of addition (a + b), subtraction (a - b) and multiplication (a × b) of that case, one result per lines.
意思大致是:
对于每种情况,输出三行,分别显示该情况的加法(a+b)、减法(a-b)和乘法(a×b)的精确结果,每行一个结果。
示例
输入
20000000000000000
4000000000000000
输出
24000000000000000
16000000000000000
80000000000000000000000000000000
代码
1 | #include <stdio.h> |
3 分析
- 今天题目真心不好做,我现在怀疑出这个题的人的脑回路了
转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达,可以邮件至 xingshuaikun@163.com。