Q10055: Hashmat the brave warrior
import java.util.*;
public class Main{
public static void main(String[] args) {
Scanner scn =new Scanner (System.in);
while(scn.hasNext()){
long a=scn.nextLong(),b=scn.nextLong();
System.out.printf("%d\n",a>b?a-b:b-a);
}
}
}
/*
題目:Q10055: Hashmat the brave warrior
作者:1010
時間:西元 2016 年 6 月 */
困難度 ★
*注意題目有說這些數不會超過232所以要注意資料型態
Java使用long 輸入記得使用nextLong()以免測試結果Runtime error
C使用long long 輸出搭配%lli
提醒 使用內建函示庫Math.abs(a-b)取絕對值會Runtime error
提醒 使用內建函示庫Math.abs(a-b)取絕對值會Runtime error
沒有留言:
張貼留言