现在的位置: 首页 > 综合 > 正文

poj 1663 Number Steps

2012年12月04日 ⁄ 综合 ⁄ 共 317字 ⁄ 字号 评论关闭
#include <iostream>
using namespace std;

int main()
{
    int tc, i, x, y;
    cin >> tc;
    bool flag; 
    while (tc--){
          cin >> x >> y; 
          flag = false; 
          if (x % 2 == 0 && y % 2 == 0){
               if (y == x - 2 || x == y) 
                   cout << x + y << endl;
               else 
                   cout << "No Number" << endl; 
          } 
          else if (x % 2 == 1 && y % 2 == 1){
               if (y == x - 2 || x == y) 
                   cout << x + y - 1 << endl;
               else 
                   cout << "No Number" << endl; 
          }
          else 
               cout << "No Number" << endl; 
    } 
    
    system("pause"); 
} 

抱歉!评论已关闭.