Question M: Cloning toys

Source: Internet
Author: User

The title describes that you have only one type a toy and now has a machine with two functions:
1. Processing a toy of type A can then get a toy of type A and a toy of type B.
2. A toy of type B can be processed with two toys of type B.
Q: After many processing, can you just get n B type toys and m a type of toys (you can't throw away any toys).
Enter two integers n,m (0<=n,m<=1e9) after processing the number of B-type toys and the number of a-type toys. Output can get just n b types of toys and m a type of toys output: Yes
Output: no example input
6 3
Sample output
Yes
Tips

example, using two times function 1, get three Class A toys and two Class B toys, and then use two times function 2, and then get 4 B toys, so that altogether got 6 toys B and 3 toys A.

#include <stdio.h>intMain () {intN, M; intFlag =0; scanf ("%d%d", &n, &m); if(M = =0&& n >0) {printf ("No"); return 0; }    Else if(M-n >1) Flag=0; Else if((N-m +1) %2==0) Flag=1; if(Flag = =1) printf ("Yes"); Elseprintf ("No"); return 0;}

Question M: Cloning toys

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.