【JAVA】UVA 10055 - Hashmat the Brave Warrior

題目原文:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=996

Sample Input
10 12
10 14
100 200
Sample Output
2
4
100

題目大意:取兩數差,題目限制最大值為2^32,因此需要使用long。

import java.util.*;
public class main{
    public static void main(String[] args) {
            Scanner sc=new Scanner(System.in);
            while(sc.hasNextLong()){
            long a = sc.nextLong(),b = sc.nextLong();
    		System.out.println(Math.abs(a-b));
    		}
    }
};