题解 | #Number Steps#

Number Steps

https://www.nowcoder.com/practice/e3d8d4dd9ec740f9b1e7fc1e8574ba21

#include <iostream>

using namespace std;

int main() {
    int x = 0;
    int y = 0;
    while (cin >> x >> y){
        if (y == x || y == x - 2){
            if (x % 2 == 0)
                cout << x + y <<endl;
            else
                cout << x + y - 1 << endl;
        } else {
            cout << "No Number" << endl; 
        }
    }
    return 0;
}

全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务