Discus Throw Codechef Solution
In discus throw, a player is given 33 throws and the throw with the longest distance is regarded as their final score.
You are given the distances for all 33 throws of a player. Determine the final score of the player.
Input Format
- First line will contain TT, number of test cases. Then the test cases follow.
- Each test case contains of a single line of input, three integers A,B,A,B, and CC denoting the distances in each throw.
Output Format
For each test case, output the final score of the player.
Constraints
- 1≤T≤1001≤T≤100
- 1≤A,B,C≤1001≤A,B,C≤100
Sample Input 1
3
10 15 8
32 32 32
82 45 54
Sample Output 1
15
32
82
Explanation
Test Case 11: The longest distance is achieved in the second throw, which is equal to 1515 units. Thus, the answer is 1515.
Test Case 22: In all throws, the distance is 3232 units. Thus, the final score is 3232.
Test Case 33: The longest distance is achieved in the first throw which is equal to 8282 units. Thus, the answer is 8282.
Discus Throw Codechef SOLUTION
C++
Join our telegram group for codes.
Due to copyright issues we are not posting the solutions here.
#include <iostream>
#include<cmath>
using namespace std;
#define Priya() int y; cin>>y; while(y--)
int main() {
Priya(){
int p,q,s;
cin>>p>>q>>s;
int high = max(p,q);
int ans = max(high,s);
cout<<ans<<endl;
}
return 0;
}
Java
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();
while(t--!=0){
int a=sc.nextInt();
int b=sc.nextInt();
int c=sc.nextInt();
System.out.println(Math.max(a,Math.max(b,c)));
}
}
}
Python
for i in range (int(input())):
t1, t2, t3 = map(int, input().split())
print(max(t1, t2, t3))
Discus Throw codechef solution Tutorial
Read More Post Here