題目連結: https://zerojudge.tw/ShowProblem?problemid=a012# 解題思路用最單純的方法求絕對值吧# 程式碼#include <iostream>using namespace std;int main(){ long long int a,b,ans; while(cin>>a>>b) { ans=a-b; if(ans<0) ans=-ans; cout<<ans << endl; }} Zerojudge 條件判斷