Sample Input:
10 12
10 14
100 200
Sample Output:
2
4
100
大意:勇敢的將軍在開戰前會先評估敵軍跟我軍的差異,給敵軍跟我軍的數量,問相差總數多少
解法: 水題 輸出相減的絕對值即可
import java.util.*;
public class UVA10055 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
long N = sc.nextLong();
long M = sc.nextLong();
System.out.println(Math.abs(N - M));
}
}
}