import java.util.*; import java.util.zip.*; import java.util.List; import java.util.regex.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; import java.util.concurrent.locks.*; import java.util.function.*; import javax.swing.*; import javax.swing.event.*; import javax.swing.text.*; import javax.swing.table.*; import java.io.*; import java.net.*; import java.lang.reflect.*; import java.lang.ref.*; import java.lang.management.*; import java.security.*; import java.security.spec.*; import java.awt.*; import java.awt.event.*; import java.awt.image.*; import java.awt.geom.*; import javax.imageio.*; import java.math.*; import java.time.Duration; // properties: // -yields a proper probability (0 < p <= 1) // -distance 0 has probability 1 // -function is monotonically decreasing // (greater distance = lower probability) // -negative distances are interpreted as positive class main { static double genericDistanceToProbability(double distance) { return 1/(1+abs(distance)); } static double genericDistanceToProbability(double a, double b) { return genericDistanceToProbability(a-b); } static float abs(float f) { return Math.abs(f); } static int abs(int i) { return Math.abs(i); } static double abs(double d) { return Math.abs(d); } }