Skip to content

Instantly share code, notes, and snippets.

@cbilson
Last active February 9, 2017 12:40
Show Gist options
  • Save cbilson/d3f97adc0e20acd3922baa6d811c6d9b to your computer and use it in GitHub Desktop.
Save cbilson/d3f97adc0e20acd3922baa6d811c6d9b to your computer and use it in GitHub Desktop.
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class Absolutely {
public static void main(String[] args) throws FileNotFoundException {
//Scanner scanner = new Scanner(System.in);
Scanner scanner = new Scanner(new File("C:\\Users\\cbilson\\Absolutely.txt"));
int problems = scanner.nextInt();
for (int i = 0; i < problems; i++) {
double x = scanner.nextDouble();
double y = scanner.nextDouble();
double d = Math.abs(x - y);
System.out.println(Math.round(d * 10.0) / 10.0);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment