Algorithm
problem Link : https://www.codechef.com/problems/INVESTMENT
Problem
Chef has invested his money at an interest rate of percent per annum while the current inflation rate is percent per annum.
An investment is called good if and only if the interest rate of the investment is at least twice of the inflation rate.
Determine whether the investment made by Chef is good or not.
Input Format
- The first line of input will contain a single integer , denoting the number of test cases.
- Each test case consists of two integers and , the interest rate and the current inflation rate respectively.
Output Format
For each test case, output YES
if the investment is good, NO
otherwise.
You can output any letter in any case. For example YES
, yes
, yES
are all considered same.
Constraints
Sample 1:
5 7 4 6 3 2 4 10 10 20 1
NO YES NO NO YES
Explanation:
Test case : The interest rate is and the current inflation rate is . Since the interest rate is less than twice of current inflation rate, the investment is not good.
Test case : The interest rate is and the current inflation rate is . Since the interest rate is equal to twice of current inflation rate, the investment is good.
Test case : The interest rate is and the current inflation rate is . Since the interest rate is less than twice of current inflation rate, the investment is not good.
Test case : The interest rate is and the current inflation rate is . Since the interest rate is less than twice of current inflation rate, the investment is not good.
Test case : The interest rate is and the current inflation rate is . Since the interest rate is greater than twice of current inflation rate, the investment is good.
Code Examples
AdvertisementsDemonstration
CodeChef solution INVESTMENT - Good Investment or Not solution in C,C++