最新消息:点击查看大S的省钱秘笈

POJ 2389 Bull Math C++版

POJ题解 Slyar 57浏览 0评论

文章作者:姜南(Slyar) 文章来源:Slyar Home (www.slyar.com) 转载请注明,谢谢合作。

高精度乘法

Description

Bulls are so much better at math than the cows. They can multiply huge integers together and get perfectly precise answers ... or so they say. Farmer John wonders if their answers are correct. Help him check the bulls' answers. Read in two positive integers (no more than 40 digits each) and compute their product. Output it as a normal number (with no extra leading zeros).

FJ asks that you do this yourself; don't use a special library function for the multiplication.

Input

* Lines 1..2: Each line contains a single decimal number.

Output

* Line 1: The exact product of the two input lines

Sample Input

11111111111111
1111111111

Sample Output

12345679011110987654321

Slyar:就是高精度乘法,这次我尝试了直接把结果保存到字符串里返回,继续试验了不少字符串函数,很爽。注意结果里的前导0要去掉。过不去的试试 20 50 这个数据,或许会有收获,我在这WA了2次...

转载请注明:Slyar Home » POJ 2389 Bull Math C++版

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址