Relativity (RELATIVE) Solution — Codechef July Long Challenge

Input

  • The first line contains an integer T, the number of test cases. Then the test cases follow.
  • Each test case contains a single line of input, two integers g, c.

Output

Constraints

  • 1≤T≤5⋅10³
  • 1≤g≤10
  • 1000≤c≤3000
  • 2⋅g divides c2.

Subtasks

Sample Input

3
7 1400
5 1000
10 1000

Sample Output

140000
100000
50000

Explanation

/* 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 t = sc.nextInt();
while(t-->0){
int g = sc.nextInt();
int v = sc.nextInt();
System.out.println((v*v)/(2*g));
}
}
}

--

--

--

Software Developer ,currently pursuing B.Tech in Information Technology. Electronic Dance Music is love.Also like all phone related technologies

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Hi folks,

Tools I Use

5 Things I’ve Learned as a Beginner Software Developer

What to expect from re:Invent 2020?

BASICS OF BECOMING A FRONTEND DEVELOPER

The Architecture of HFT System

Gem in Ruby and Rails

What is Filebase and How do you use it?

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Anubhav Mishra

Anubhav Mishra

Software Developer ,currently pursuing B.Tech in Information Technology. Electronic Dance Music is love.Also like all phone related technologies

More from Medium

JDK vs JRE vs JVM: Key Differences

Two Sorting Algorithms You Must Know About — Quick Sort and Merge Sort

Why do Software Engineers need to consider more about time zones?

What is Reactive Programming? | Interview basics