题解 | 变幻莫测

变幻莫测

https://www.nowcoder.com/practice/5e702b6c7c114e64b5db4650d0ce0051

#include<bits/stdc++.h>
#define int long long
using namespace std;
void solve() {
    int a, b;
    cin >> a >> b;
    if(a==b){
        cout<<0<<endl;
    }else if(a==0){
        cout<<2<<endl;
    }else if(b==0){
        cout<<1<<endl;
    }else if(abs(a)==abs(b)){
        cout<<3<<endl;
    }else{
        cout<<-1<<endl;
    }
}
signed main() {
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    cout << fixed << setprecision(3);
    int t = 1;
    //  cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}

全部评论

相关推荐

评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务