解法一、函式庫
✅ 完整代碼
評分結果(參考) : AC (2ms, 344KB)
#include <bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    cout << abs(n);
    return 0;
}評分結果(參考) : AC (2ms, 344KB)
#include <bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    cout << abs(n);
    return 0;
}