Algorithm
problem Link : https://www.codechef.com/problems/EXPIRY
Problem
Eikooc loves bread. She has loaves of bread, all of which expire after exactly days. She can eat upto loaves of bread in a day. Can she eat all the loaves of bread before they expire?
Input Format
- The first line contains a single integer - the number of test cases. Then the test cases follow.
- Each test case consists of a single line containing three integers , and - the number of loaves of bread Eikooc has, the number of days after which all the breads will expire and the number of loaves of bread Eikooc can eat in a day.
Output Format
For each test case, output Yes
if it will be possible for Eikooc to eat all the loaves of bread before they expire. Otherwise output No
.
You may print each character of Yes
and No
in uppercase or lowercase (for example, yes
, yEs
, YES
will be considered identical).
Constraints
Sample 1:
3 100 100 1 9 2 5 19 6 3
Yes Yes No
Explanation:
Test case 1: Eikooc can eat one loaf of bread per day for days. Thus none of the bread expires.
Test case 2: Eikooc can eat loaves of the first day and loaves on the second day. Thus none of the bread expires.
Test case 3: There is no way Eikooc can consume all the loaves of bread before it expires.
Code Examples
#1 Code Example with C Programming
Code -
C Programming
#include<stdio.h>
int main(void) {
int t,m,n,k;
scanf("%d",&t);
while(t--)
{
scanf("%d %d %d",&m,&n,&k);
if(m<=n*k) printf("Yes\n");
else printf("No\n">;
}
return 0;
}
Copy The Code &
Try With Live Editor
Input
100 100 1
9 2 5
19 6 3
Output
Yes
No
Demonstration
CodeChef solution XPIRY - Expiring Bread Codechef solution in C,C++