这题目给的测试用例不对,根本就没有点的总数。

Number Steps

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

//Java
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int y = sc.nextInt();
        if (x == y || x == y + 2) {
            if (x % 2 == 0) {
                System.out.println(x + y);
            } else {
                System.out.println(x + y - 1);
            }
        } else {
            System.out.println("No Number");
        }
    }
}
#Python
x, y = map(int, input().split())
if x == y or x == y + 2:
    if x % 2 == 0:
        print(x + y)
    else:
        print(x + y - 1)
else:
    print('No Number')

全部评论

相关推荐

点赞 评论 收藏
分享
评论
3
收藏
分享

创作者周榜

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