-
Notifications
You must be signed in to change notification settings - Fork 0
/
Discus Throw
50 lines (42 loc) · 1.46 KB
/
Discus Throw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Problem
In discus throw, a player is given 3 throws and the throw with the longest distance is regarded as their final score.
You are given the distances for all 3 throws of a player. Determine the final score of the player.
Input Format
First line will contain T, number of test cases. Then the test cases follow.
Each test case contains of a single line of input, three integers ,A,B, and C denoting the distances in each throw.
Output Format
For each test case, output the final score of the player.
Explanation
Test Case 1:
The longest distance is achieved in the second throw, which is equal to 15 units. Thus, the answer is 15.
Test Case 2:
In all throws, the distance is 32 units. Thus, the final score is 32.
Test Case 3: The longest distance is achieved in the first throw which is equal to 82 units.
Thus, the answer is 82.
/* 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 a=sc.nextInt();
int b=sc.nextInt();
int c=sc.nextInt();
if(a>=b && a>=c){
System.out.println(a);
}
else if(b>=a &&b>=c){
System.out.println(b);
}
else{
System.out.println(c);
}
}// your code goes here
}
}