HONEY LOVES MONEY Solutions BVPCSI04

HONEY LOVES MONEY Solutions BVPCSI04

Nectar adores cash. He found a plan that can clone gold coins. Nectar realizes that on the off chance that he applies the plan to a unique gold coin, he moreover gets one more unique gold coin and one imitation, and on the off chance that he applies the plan to a reproduction gold coin, he gets two extra copies. 

At first, Honey has just a single unique gold coin. He needs to know whether it is conceivable to utilize this plan to get precisely x copy gold coins and y unique gold coins? He can’t discard gold coins, and he can’t make a difference the plan to an imitation in the event that he doesn’t right now have any copies. 

 

Information 

The main line contains two whole numbers x and y — the quantity of duplicates and the quantity of unique gold coins Imp needs to get (counting the underlying one). 

 

Yield 

Print “Yes”, if the ideal arrangement is conceivable, and “No” something else. 

 

Requirements 

(0 ≤ x, y ≤ 109) 

 

Test input 

6 3 

 

Test yield 

Indeed 

 

Test input 

4 2 

 

Test yield 

No 

 

Test input 

1000 1001 

 

Test yield 

Indeed 

 

Clarification 

In the primary model, Imp needs to apply the machine twice to unique toys and afterward twice to duplicates.

 

 
CODE C++14 :
 

 

 
#include <iostream>
using namespace std;
 
int main(){
    long int x, y;
    cin >> x >> y;
    if(y==0){
        cout << “No” << endl;
    }
    else if(y==1){
        if(x==0)
            cout << “Yes” << endl;
        else
            cout << “No” << endl;
    }
    else if(x<y){
        if(x-y==-1)
            cout << “Yes” << endl;
        else
            cout << “No” << endl;
    }
    else{
        if(y%2==0){
            if(x%2!=0)
                cout << “Yes” << endl;
            else
                cout << “No” << endl;
        }
        else{
            if(x%2==0)
                cout << “Yes” << endl;
            else
                cout << “No” << endl;
        }
    }
    return 0;
}
 
 

 

March Long Challenge 2021 Solutions

April Long Challenge 2021 Solutions

Codechef Long Challenge Solutions

February Long Challenge 2021

1. Frog Sort Solution Codechef

2. Chef and Meetings Solution Codechef

3. Maximise Function Solution Codechef

4. Highest Divisor Solution Codechef

5. Cut the Cake Challenge Solution Codechef

6. Dream and the Multiverse Solution Codechef

7. Cell Shell Solution Codechef

8. Multiple Games Solution Codechef

9. Another Tree with Number Theory Solution Codechef

10. XOR Sums Solution Codechef

11. Prime Game Solution CodeChef

12. Team Name Solution Codechef

January Long Challenge 2021

November Challenge 2020 SOLUTION CodeChef

October Lunchtime 2020 CodeChef SOLUTIONS

RELATED :

Related :

Related :

Leave a Comment

close
error: Content is protected !!
Free Udemy Courses and Hacking Resources Join Us on TelegramClick Here
+