POJ 1663
題意
找規(guī)律
思路
分成兩種情況x==y(tǒng)和x==y(tǒng)+2;x == y的時(shí)候 再根據(jù)x或者y的奇偶分情況討論
很簡單憎瘸,沒什么好說的。
#include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
int n,x,y,ans;
cin>>n;
while(n--){
cin>>x>>y;
if(x == y){
if(x%2==0)
ans =2*x;
else
ans = 2*x -1;
}
else if(x == y+2){
if(x%2 == 0)
ans = 2*x - 2;
else
ans = 2*x - 3;
}
else{
cout<<"No Number"<<endl;
}
cout<<ans<<endl;
}
return 0;
}