Physical Address

304 North Cardinal St.
Dorchester Center, MA 02124

Secret Recipe CodeChef Solution

Problem – Secret Recipe CodeChef Solution

This website is dedicated for CodeChef solution where we will publish right solution of all your favourite CodeChef problems along with detailed explanatory of different competitive programming concepts and languages.
<<Previous CodeChef Problem Next Codechef Problem>>

Secret Recipe CodeChef Solution in C++14

#include <iostream>
using namespace std;

int main() {
	// your code goes here
	int t;
	cin>>t;
	for(int i=0;i<t;i++)
	{
	    int x1,x2,x3,v1,v2;
	    cin>>x1>>x2>>x3>>v1>>v2;
	    if((float)abs(x1-x3)/v1 > (float)abs(x2-x3)/v2)
	      cout<<"Kefa\n";
	    else if((float)abs(x1-x3)/v1 < (float)abs(x2-x3)/v2)
	      cout<<"Chef\n";
	    else cout<<"Draw\n";
	}
	return 0;
}

Secret Recipe CodeChef Solution in PYTH 3

n=int(input())
for i in range(n):
    a=list(map(int,input().split()))
    num1=a[2]-a[0]
    num2=a[1]-a[2]
    num1=num1/a[3]
    num2=num2/a[4]
    if(num1<num2):
        print("Chef")
    elif(num1==num2):
        print("Draw")
    else:
        print("Kefa")
    num1,num2=0,0

Secret Recipe CodeChef Solution in C

#include <stdio.h>

int main(void) {
	// your code goes here
	int t;
	scanf("%d",&t);
	while(t--){
	    float x1,x2,x3,v1,v2;
	    scanf("%f%f%f%f%f",&x1,&x2,&x3,&v1,&v2);
	    float t1=(x3-x1)/v1;
	    float t2=(x2-x3)/v2;
	    if(t1==t2){
	        printf("Draw\n");
	    }
	    else if(t1<t2){
	        printf("Chef\n");
	    }
	    else if(t2<t1){
	        printf("Kefa\n");
	    }
	}
	return 0;
}

Secret Recipe CodeChef Solution in JAVA

/* 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
	{
		// your code goes here
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		while(n-->0)
		{
		    int x1=sc.nextInt();
		    int x2=sc.nextInt();
		    int x3=sc.nextInt();
		    int sp1=sc.nextInt();
		    int sp2=sc.nextInt();
		    float dist1=x3-x1;
		    float dist2=x2-x3;
		    float time1=dist1/sp1;
		    float time2=dist2/sp2;
		    if(time1>time2)
		    {
		        System.out.println("Kefa");
		    }
		    else if(time1<time2)
		    {
		        System.out.println("Chef");
		    }
		    else if(time1==time2)
		    {
		        System.out.println("Draw");
		    }
		}
	}
}

Secret Recipe CodeChef Solution in PYPY 3

for i in range(int(input())):
    a=list(map(int,input().split()))
    if ((a[2]-a[0])/a[3])>((a[1]-a[2])/a[4]):
        print("Kefa")
    elif ((a[2]-a[0])/a[3])<((a[1]-a[2])/a[4]):
        print("Chef")
    else:
        print("Draw")

Secret Recipe CodeChef Solution in PYTH

t = int(raw_input())
for i in xrange(t):
	st = raw_input().split()
	X1 = int(st[0])
	X2 = int(st[1])
	X3 = int(st[2])
	V1 = int(st[3])
	V2 = int(st[4])
	dx1 = X3-X1
	dx2 = X2-X3
	if dx1*V2 < dx2*V1:
		rst = 'Chef'
	else:
		rst = 'Kefa'
	# endif
	if dx1*V2 == dx2*V1:
		rst = 'Draw'
	# endif
	print rst
# endfor i

Secret Recipe CodeChef Solution in C#

using System;

public class Test
{
	public static void Main()
	{
		// your code goes here
		int t = int.Parse(Console.ReadLine());
		while(t-->0){
		    string[] str =  Console.ReadLine().Split(' ');
		    int x1 = int.Parse(str[0]);
		    int x2 = int.Parse(str[1]);
		    int x3 = int.Parse(str[2]);
		    int v1 = int.Parse(str[3]);
		    int v2 = int.Parse(str[4]);
		    double t1 = Math.Abs(x3-x1)/(1.0*v1);
		    double t2 = Math.Abs(x3-x2)/(1.0*v2);
		    if(t1>t2){
		        Console.WriteLine("Kefa");
		    }
		    else if(t1==t2){
		        Console.WriteLine("Draw");
		    }
		    else{
		        Console.WriteLine("Chef");
		    }
		}
	}
}

Secret Recipe CodeChef Solution in NODEJS

process.stdin.resume();
process.stdin.setEncoding('utf8');

process.stdin.on('data',cacheInput).on('end',main);
let input='';
function cacheInput(data){
    input+=data;
}

function main(){
    input=input.split("\n");
    // console.log(input);
    let t=input.shift();
    // console.log(t);
    for (i=0;i<t;i++){
        n=input[i].split(" ").map(Number);
        // console.log(a);
        let X1 = parseInt(n[0]);
        let X2 = parseInt(n[1]);
        let X3 = parseInt(n[2]);
        let V1 = parseInt(n[3]);
        let V2 = parseInt(n[4]);
        
        let time1 = (X3 - X1)/V1;
        let time2 = (X2 - X3)/V2;
        
        if(time1>time2){
            console.log("Kefa");
        }
        else if(time2>time1){
            console.log("Chef");
        }
        else{
            console.log("Draw");
        }
    }
}

Secret Recipe CodeChef Solution in RUBY

gets.to_i.times do
    t = gets.chomp.split().map{|s| s.to_f}
    chef = t[2]-t[0]
    kefa = t[1]-t[2]
    chef = chef.abs
    kefa = kefa.abs
    v1=t[3]
    v2=t[4]
    time1 = chef/v1
    time2 = kefa/v2
    if time1<time2
        puts "Chef"
    else
        if time1>time2
            puts "Kefa"
        else
            puts "Draw"
        end
    end
end
Secret Recipe CodeChef Solution Review:

In our experience, we suggest you solve this Secret Recipe 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 Secret Recipe CodeChef Solution.

Find on CodeChef

Conclusion:

I hope this Secret Recipe 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 Programming Language in a business context; there are no prerequisites.

Keep Learning!

More Coding Solutions >>

Cognitive Class Answer

CodeChef Solution

Microsoft Learn

Leave a Reply

Your email address will not be published. Required fields are marked *