304 North Cardinal St.
Dorchester Center, MA 02124

# Enough Space CodeChef Solution

## Problem – Enough Space CodeChef Solution

Chef’s computer has N GB of free space. He wants to save X files, each of size 1 GB and Y files, each of size 2 GB on his computer. Will he be able to do so?

Chef can save all the files on his computer only if the total size of the files is less than or equal to the space available on his computer.

#### Input Format

• The first line contains an integer T, denoting the number of test cases. The T test cases then follow:
• The first and only line of each test case contains three integers N,X,Y, denoting the free-space in computer, the number of 1 and 2 GB files respectively.

#### Output Format

For each test case, print YES if Chef is able to save the files and NO otherwise.

You may print each character of the string in uppercase or lowercase (for example, the strings yEsyesYes and YES will all be treated as identical).

#### Constraints

• 1 \leq T \leq 1001≤T≤100
• 1 \leq N, X, Y \leq 1001≤N,X,Y≤100

#### Sample 1:

Input: 4
6 3 1
2 2 2
4 3 2
5 1 2
Output: YES
NO
NO
YES

#### Explanation:

Test case 1: The total size of files is 3 + 1 \cdot 2 =53+1⋅2=5, which is smaller than the remaining space on the computer. Thus Chef will be able to save all the files.

Test case 2: The total size of files is 2 + 2 \cdot 2 =62+2⋅2=6, which is greater than the remaining space on the computer. Thus Chef will not be able to save all the files.

Test case 3: The total size of files is 3 + 2 \cdot 2 =73+2⋅2=7, which is greater than the remaining space on the computer. Thus Chef will not be able to save all the files.

Test case 4: The total size of files is 1 + 2 \cdot 2 =51+2⋅2=5, which is equal to the remaining space on the computer. Thus Chef will be able to save all the files.

### Enough Space CodeChef Solution in C++17

#include <iostream>
using namespace std;

int main() {
int t,n,x,y;
cin>>t;
while(t--){
cin>>n>>x>>y;
if(((1*x)+(2*y))<=n)
cout<<"yes"<<endl;
else
cout<<"no"<<endl;
}
return 0;
}


### Enough Space CodeChef Solution in Python3

t=int(input())
for i in range(t):
a,b,c=map(int,input().split())
x=b*1
y=c*2
if (x+y)<=a:
print("YES")
else:
print("NO")



### Enough Space CodeChef Solution in Java

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 t = sc.nextInt();

for (int i = 1; i <= t; i++) {
int n = sc.nextInt();
int x = sc.nextInt();
int y = sc.nextInt();

y = y * 2;
if((x + y) <= n)
System.out.println("Yes");
else System.out.println("No");
}
}
}

##### Enough Space CodeChef Solution Review:

In our experience, we suggest you solve this Enough Space 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 Enough Space CodeChef Solution

Find on CodeChef

##### Conclusion:

I hope this Enough Space 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 >>

LeetCode Solutions

Hacker Rank Solutions

CodeChef Solutions