1920: Jojer JAVA大数

本文介绍了一个编程挑战,任务是编写程序来处理两个大数之间的加法、减法、乘法和除法运算,并输出结果。使用了Java语言及BigInteger类来确保能够处理长达50位数字的运算。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1920: Jojer


ResultTIME LimitMEMORY LimitRun TimesAC TimesJUDGE
3s8192K707223Standard

Mr Jojer is a teacher, and he is crazy in programming, he wants the computer to do every thing for him, one day, one of his colleague Mr NEtiger asks him to write a procedure for him. But Mr Jojer has another difficult problem, so he asks you to do it for him. Do you want a try? Ok, let's begin!

There are two numbers for the pupils to operate, Mr NEtiger wants to know the answers of plus, minus, multiply, divide,so he can check the answers which the pupils hand in.

The input contain two numbers, you should output the answers in the order of plus, minus, multiply, divide. You may assume that they are dividable and no remainder.

Is it easy? But you should know the numbers may as long as 50 digits.

Sample Input

10 2
15 3

Sample Output

12
8
20
5
18
12
45
5

 


This problem is used for contest: 60  

 

 

 

import java.io.*;

import java.util.*;

import java.math.*;

import java.text.*;

public class Main {

  public static void main(String[] args) {

   Scanner cin =new Scanner (System.in);

   BigInteger a,b;

   while(cin.hasNext() )

   {

      a=cin.nextBigInteger() ;

      b=cin.nextBigInteger() ;

      System.out.println(a.add(b));

      System.out.println(a.subtract(b));

      System.out.println(a.multiply(b));

      System.out.println(a.divide(b));

   }

  }

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值