牛客等级之题N2(8.12场)小 w 的 a+b 问题

题目链接:https://ac.nowcoder.com/acm/contest/7024/A

分析

根据32位整形定义,知 c = -1 时,无解,其余情况下只需令 a = INT_MAX即可

代码

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

int main(){
    int c, b;
    cin >> c;
    if (c == -1){
        printf("No solution\n");
        return 0;
    }
    b = c - INT_MAX;
    cout << INT_MAX << " " << b << endl;
    return 0;
}

有收获?希望老铁们来个三连击,给更多的人看到这篇文章

1、给俺点个赞呗,可以让更多的人看到这篇文章,顺便激励下我,嘻嘻。

2、老铁们,关注我的原创微信公众号「Grand Theft Algorithm」,专注于写算法题解 + 计算机基础知识

猜你喜欢

转载自blog.csdn.net/weixin_42396397/article/details/107965435