Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions CHEFRUN.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
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 in = new Scanner(System.in);
int length = in.nextInt();
Double x1,x2,x3,v1,v2 ;
Double d1,d2;
for (int i = 0; i < length ; i++) {
x1 = in.nextDouble();
x2 = in.nextDouble();
x3 = in.nextDouble();
v1 = in.nextDouble();
v2 = in.nextDouble();

x1 = x3 -x1;
x2 = x2-x3;

if((x1/v1) == (x2/v2)){
System.out.println("Draw");
}else if((x1/v1) < (x2/v2)){
System.out.println("Chef");
}else
System.out.println("Kefa");

}
}
}
24 changes: 24 additions & 0 deletions FLOW004.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
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 in = new Scanner(System.in);
int testCases = in.nextInt();
int i = 0;
int sum = 0;
while (i < testCases) {

String number = in.next();
String[] arr = number.split("");
sum = Integer.parseInt(arr[0]) + Integer.parseInt(arr[arr.length-1]);
System.out.println(sum);
i++;
}
}
}
28 changes: 28 additions & 0 deletions FLOW018.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/* 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 in = new Scanner(System.in);
int testCases = in.nextInt();
int i = 0;
int sum = 1;
int num = 0;
while (i < testCases) {
num = in.nextInt();
for (int j = 1; j <= num; j++) {
sum=sum*j;
}
System.out.println(sum);
sum = 1;
i++;
}
}
}
34 changes: 34 additions & 0 deletions NAICHEF.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public.
* @author Rana M. Suleman
*/
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{

Scanner in = new Scanner(System.in);

int length = in.nextInt();
do{
int[] arr = new int[in.nextInt()];
double a = in.nextDouble();
double b = in.nextDouble();
for (int i = 0; i < arr.length ; i++) {
arr[i] = in.nextInt();
}

double a_faces=0,b_faces = 0;
for (int value: arr) {
if(value == a) a_faces++;
if(value == b) b_faces++;
}
System.out.println((a_faces/ ((double) arr.length))*(b_faces/ ((double) arr.length)));
length--;
}while(length != 0);

}
}