题解 | #Number Steps#
Number Steps
https://www.nowcoder.com/practice/e3d8d4dd9ec740f9b1e7fc1e8574ba21
#include <stdio.h> int f1(int x,int y) { if(x%2==0) return x*2-2; return x*2-3; } int f2(int x,int y) { if(x%2==0) return x+y; return x+y-1; } int main() { int x,y; while(scanf("%d %d",&x,&y)!=EOF) { if(x-y==2) printf("%d\n",f1(x,y)); else if(x==y) printf("%d\n",f2(x,y)); else printf("No Number\n"); } return 0; }