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

How to Modify the Video BIOS of AMD Radeon GPUs for Better Hashrate

CS371g Summer 2021: Sang Pham

Hexagonal Architecture in Python

Google Assistant with Python Fulfillment

[Update 2] How to build and install TensorFlow GPU/CPU for Windows from source code using bazel…

How to Setup a Local GitLab Source Code Management — Part I

SSL Pinning for secure connection between iOS app and server in Swift.

So, What Does the NGINX Ingress Controller Actually Do?

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

How Works Object Creation ?

What is the difference between “.equals()” vs “==” in java

How to solve the “Fibonacci Number modulo M” Problem in Java

Fibonacci numbers

Min-Max Sum | HackerRank Problem | Java Solution