d058. BASIC 的 SGN 函數

解法一

✅ 完整代碼

評分結果(參考) : AC (2ms, 332KB)

#include <bits/stdc++.h>
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int num;
    cin >> num;

    if(num < 0) cout << -1;
    else if(num > 0) cout << 1;
    else cout << 0;

    return 0;
}