Problem
Chef's computer has GB of free space. He wants to save files, each of size 1 GB and 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 , denoting the number of test cases. The test cases then follow:
- The first and only line of each test case contains three integers , denoting the free-space in computer, the number of
1and2GB 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 yEs, yes, Yes and YES will all be treated as identical).
Constraints
Sample 1:
4
6 3 1
2 2 2
4 3 2
5 1 2
YES
NO
NO
YES
Explanation:
Test case : The total size of files is , which is smaller than the remaining space on the computer. Thus Chef will be able to save all the files.
Test case : The total size of files is , which is greater than the remaining space on the computer. Thus Chef will not be able to save all the files.
Test case : The total size of files is , which is greater than the remaining space on the computer. Thus Chef will not be able to save all the files.
Test case : The total size of files is , which is equal to the remaining space on the computer. Thus Chef will be able to save all the files.
Solution:
C++
#include
using namespace std;
int main() {
// your code goes here
int test_cases, a, b, c;
cin >> test_cases;
for(int x=0; x> a >> b >> c;
if(a>=(b+(2*c))){
cout << "YES" << endl;
}
else{
cout << "NO" << endl;
}
}
return 0;
}
0 Comments