hdu 1391 Number Steps(规律)

题意:找规律

思路:找规律

#include<iostream>
#include<stdio.h>
using namespace std;

int main(){
    int n,x,y;
    scanf("%d",&n);
    while(n--){
        scanf("%d%d",&x,&y);
        if(x==y)x&1?printf("%d\n",x+x-1):printf("%d\n",x+x);
        else if(x-y==2)x&1?printf("%d\n",x+y-1):printf("%d\n",x+y);
        else printf("No Number\n");
    }
    return 0;
}
View Code

 

posted @ 2015-08-14 11:52  gongpixin  阅读(167)  评论(0编辑  收藏  举报