题解 | 构造序列

构造序列

https://www.nowcoder.com/practice/9107a15263d2464298a95bba845e08af

#include <iostream>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,m;
    cin>>n>>m;
    int a=max(n,m);
    int b=min(n,m);
    if(a<=b+1)cout<<a+b;
    else cout<<2*b+1;
    return 0;
}
// 64 位输出请用 printf("%lld")

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

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