两个长整数减法 java,chaochang 【问题描述】 编写程序实现两个超长正整数(每个最长80位数字)的减法运算 【 Embeded-SCM Develop 嵌入式/单片机编程 238万源代码...

详细说明:【问题描述】

编写程序实现两个超长正整数(每个最长80位数字)的减法运算。

【输入形式】

从键盘读入两个整数,要考虑输入高位可能为0的情况(如00083)。

1. 第一行是超长正整数A;

2. 第二行是超长正整数B;

【输出形式】

输出只有一行,是长整数A减去长整数B的运算结果,从高到低依次输出各位数字。要求:若结果为0,则只输出一个0;否则输出的结果的最高位不能为0,并且各位数字紧密输出。

【输入样例】

234098

134098703578230056

【输出样例】

-134098703577995958

【样例说明】

进行两个正整数减法运算, 234098 -134098703578230056 = -134098703577995958。-Problem Description]

Write a program to achieve two long integer (each up to 80 digits) subtraction.

[Input form]

Reading from the keyboard into two integers, may want to consider a high input is zero (eg 00083).

1 The first line is a long integer A

(2) The second line is the long integer B

[Output] form

Output only one line, is a long integer A B minus the long integer arithmetic result, the output of the digits in descending order. Requirements: If the result is 0, only outputs a 0 highest level otherwise the output result can not be 0, and you close the digital output.

[Sample input]

234,098

134098703578230056

Sample output]

-134098703577995958

[Sample Description]

Be two positive integers subtraction, 234,098-134098703578230056 =-134098703577995958.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值