Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Bob has X rupees and goes to a market. The cost of apples is Rs. A per kg and the cost of oranges is Rs. B per kg.
Determine whether he can buy at least 1 kg each of apples and oranges.
Print a single line containing Yes
if Bob can buy the fruits and No
otherwise.
You may print each character of the string in uppercase or lowercase (for example, the strings yes
, Yes
, yEs
, and YES
will all be treated as identical).
Input: 14
2 2
Output: Yes
The cost of buying 1 kg each of apple and orange is 2+2=4. Since Bob has more than 4 rupees, the answer will be Yes
.
Input: 1
1 1
Output: No
Bob can only buy either 1 kg of apples or 1 kg of oranges with 1 rupee, hence the answer is No
.
Input: 5
3 2
Output: Yes
The cost of buying 1 kg each of apple and orange is 3+2=5. Since Bob has exactly 5 rupees, the answer will be Yes
.
Input: 10000
5000 6000
Output: No
The cost of buying 1 kg each of apple and orange is 5000+6000=11000. Since Bob has only 10000 rupees, the answer will be No
.
x=int(input())
a,b=map(int,input().split())
a=a+b
print('YES' if a<=x else 'NO')
#include <iostream>
using namespace std;
int main()
{
int x,a,b;
cin>>x>>a>>b;
if(x>=(a+b))
cout<<"Yes"<<endl;
else
cout<<"no"<<endl;
return 0;
}
import java.util.*;
import java.lang.*;
import java.io.*;
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc=new Scanner(System.in);
int a=sc.nextInt();
int b=sc.nextInt();
int c=sc.nextInt();
if((b+c)>a)
{
System.out.println("no");
}
else
System.out.println("yes");
}
}
In our experience, we suggest you solve this Apples and Oranges CodeChef Solution and gain some new skills from Professionals completely free and we assure you will be worth it.
If you are stuck anywhere between any coding problem, just visit Queslers to get the Apples and Oranges CodeChef Solution
I hope this Apples and Oranges CodeChef Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.
This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.
Keep Learning!
More Coding Solutions >>