題目簡述:輸入 a、b (數字不超過 263),求 a 和 b 的差。
題目 / ZJ
錯誤作法:用 int 宣告 a、b。
解法:改用 long long。
#include <iostream>
using namespace std;
int main(){
ios::sync_with_stdio(0), cin.tie(0);
long long a, b;
while(cin >> a >> b){
cout << abs(a-b) << '\n';
}
}
👉 回到:【CPE大學程式能力檢定】目錄