Zoj 1414 number steps

Source: Internet
Author: User

Zoj
1414 number steps

Http://acm.zju.edu.cn/onlinejudge/showProblem.do? Problemcode = 1414.

According to the coordinate system given in the figure, give a coordinate and write the number on the coordinate. If it does not exist, output no number.

There are two rules:

1.
This rule and 2388 seem to have the same parity between the two numbers.

2.
When the two numbers are the same as the even number, the coordinate is required. When the two numbers are both odd, the coordinate and-1 are required.

The Code is as follows:

 

#include<stdio.h>int main(){int i,n,a,b;scanf("%d",&n);for(i = 1;i<=n;i++){scanf("%d%d",&a,&b);if((a+b)%2!=0){printf("No Number\n");continue;}if(a%2==0&&b%2==0)printf("%d\n",a+b);if(a%2!=0&&b%2!=0)printf("%d\n",a+b-1);}return 0;}

 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.