World Record Codechef Solution

Hello Programmers In this post, you will know how to solve the World Record Codechef Solution.

World Record Codechef Solution
World Record Codechef Solution

One more thing to add, don’t directly look for the solutions, first try to solve the problems of Codechef by yourself. If you find any difficulty after trying several times, then you can look for solutions.

Problem

“Usain Bolt makes a new world record completing 100100 m in 9.589.58 seconds”.

This news headline has been echoing in Chef’s mind since 20092009 when he started his career in sprinting. This time in the 20212021 Tokyo Olympics he is determined to make a new world record.

There are mainly 33 important factors that result in the variation in speed during practice and during competition.

  • The first factor is a difference in track material which results in variation in the speed at competition with respect to practice by a factor of k1k1.
  • The second factor is wind speed which results in variation in the speed at competition with respect to practice by a factor of k2k2.
  • The final factor is the maximum speed achieved during practice. If the maximum speed during practice is vv m/s then in competition it will be k3∗vk3∗v m/s.

Given Chef’s max speed vv during practice and the factors k1,k2,k3k1,k2,k3, find whether he will be able to create a new world record, i.e, can he complete 100100 m in less than 9.589.58 seconds?

Note: The final time displayed by the Olympics clock is showing after rounding the original time to 22 places of decimal and is the only measure of runners performance.

Input:

  • First line will contain TT, number of testcases. Then the testcases follow.
  • Each testcase contains of a single line of input, four floats k1,k2,k3,vk1,k2,k3,v.

Output:

Output in a single line, the answer, which should be “YES” if it’s possible for Chef to create a new world record and “NO” if not.

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

  • 1≤T≤1051≤T≤105
  • 0<k1,k2<20<k1,k2<2
  • 0<k3≤10<k3≤1
  • 9<v<119<v<11
  • k1,k2,k3k1,k2,k3 contain 11 digit after decimal.
  • vv contains 22 digits after decimal.

Subtasks

Subtask #1 (100 points): original constraints

Sample Input 1 

3
1.0 1.0 1.0 10.45
1.0 1.0 1.0 10.44
1.0 1.0 0.9 10.44

Sample Output 1 

YES
NO
NO

Explanation

TestCase 1: Final speed of Chef after considering all the factors will be 1∗1∗1∗10.45=10.451∗1∗1∗10.45=10.45 m / sec. So the time taken to complete the race will be 100/10.45=9.569=9.57100/10.45=9.569=9.57 sec after rounding to 22 places after decimal. Since the time is strictly less than the world record time, therefore Chef can break the record.

TestCase 2: Final speed of Chef after considering all the factors will be 1∗1∗1∗10.44=10.441∗1∗1∗10.44=10.44 m / sec. So the time taken to complete the race will be 100/10.44=9.578=9.58100/10.44=9.578=9.58 sec after rounding to 22 places after decimal. Since the time is equal to the world record time, therefore Chef can’t break the record.

TestCase 3: Final speed of Chef after considering all the factors will be 1∗1∗0.9∗10.44=9.3961∗1∗0.9∗10.44=9.396 m / sec. So the time taken to complete the race will be 100/9.396=10.643=10.64100/9.396=10.643=10.64 sec after rounding to 22 places after decimal. Since the time is strictly more than the world record time, therefore Chef can’t break the record.

World Record CodeChef Solution in JAVA

import java.util.Scanner;
class cer
{
    public static void main(String[] args)
        {
            Scanner sc = new Scanner(System.in);
            int test = sc.nextInt();
            while(test-->0)
            {
               double k1=sc.nextFloat();
               double  k2=sc.nextFloat();
               double  k3=sc.nextFloat();
               double  v=sc.nextFloat();
                double speed = k1*k2*k3*v ;
                double time = (100.00)/speed ;
                time = (double) Math.round(time*100)/100 ;
                //System.out.println(ans);
                if(time < 9.58)
                    System.out.println("yes");
                else
                    System.out.println("no");
            }
        }
}

World Record CodeChef Solution in CPP

#include <bits/stdc++.h>
using namespace std;
int main() {
	int T;
	cin>>T;
	while(T--)
	{
	    float k1,k2,k3,v;
	    cin>>k1>>k2>>k3>>v;
	    float ans=100.0/(k1*k2*k3*v);
	    if(ans<9.575)
	    cout<<"YES"<<endl;
	    else
	    cout<<"NO"<<endl;
	}
	return 0;
}

World Record CodeChef Solution in Python

T = int(input())
for i in range(T):
     k1,k2,k3,v = map(float,input().split())
     a = round(100/(k1*k2*k3*v), 2)
     if a<9.58:
          print("YES")
     else:
          print("NO")
Ezoicreport this ad

Disclaimer: The above Problem (World Record) is generated by CodeChef but the solution is provided by BrokenProgrammers. This tutorial is only for Educational and Learning purposes.

Note:- I compile all programs, if there is any case program is not working and showing an error please let me know in the comment section. If you are using adblocker, please disable adblocker because some functions of the site may not work correctly.

Next: Body Mass Index Codechef Solution

Sharing Is Caring

Leave a Comment

Ezoicreport this ad