Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Chef has taken his first dose of vaccine D days ago. He may take the second dose no less than L days and no more than R days since his first dose.
Determine if Chef is too early, too late, or in the correct range for taking his second dose.
For each test case, print a single line containing one string – “Too Early” (without quotes) if it’s too early to take the vaccine, “Too Late” (without quotes) if it’s too late to take the vaccine, “Take second dose now” (without quotes) if it’s the correct time to take the vaccine.
Input:
4
10 8 12
14 2 10
4444 5555 6666
8 8 12
Output:
Take second dose now
Too Late
Too Early
Take second dose now
Test case 1: The second dose needs to be taken within 8 to 12 days and since the Day 10 lies in this range, we can take the second dose now.
Test case 2: The second dose needs to be taken within 2 to 10 days since Day 14 lies after this range, it is too late now.
Test case 3: The second dose needs to be taken within 5555 to 6666 days and since the Day 4444 lies prior to this range, it is too early now.
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
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=0;i<t;i++)
{
int d = sc.nextInt();
int l = sc.nextInt();
int r = sc.nextInt();
if((d>=l)&&(d<=r))
System.out.println("Take second dose now");
else if(d<l)
System.out.println("Too Early");
else
System.out.println("Too Late");
}
}
}
#include <iostream>
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t--){
int x ,y ,z;
cin>>x>>y>>z;
if(x>=y && x<=z){
std::cout << "Take second dose now" << std::endl;
}
else if (x<y){
std::cout << "Too Early" << std::endl;
}
else if (x>z){
std::cout << "Too Late" << std::endl;
}
}
return 0;
}
# cook your dish here
t=int(input())
for i in range(t):
x,y,z=map(int,input().split())
if y<=x and x<=z:
print("Take second dose now")
elif y>x:
print("Too Early")
else:
print("Too Late")
In our experience, we suggest you solve this Vaccine Dates 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 Vaccine Dates CodeChef Solution
I hope this Vaccine Dates 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 >>