天天看點

北郵OJ上的題目——1001

A-B Problem Submit: 6495    Accepted:674 Time Limit: 1000MS  Memory Limit: 20000K

Description

Calculate A-B

Input

Two integer a and b(-10^100 < a,b < 10^100)

Output

Output a-b

Sample Input

1 2

Sample Output

-1

Source

import java.util.*;

import java.math.*;

public class minus {

public static void main(String[] args) {

Scanner cin=new Scanner(System.in);

String num1=cin.next();

String num2=cin.next();

BigInteger n1=new BigInteger(num1);

BigInteger n2=new BigInteger(num2);

BigInteger n3=n2.negate();

BigInteger result=n1.add(n3);

System.out.println(result);

}

}