1.

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
/**
* FWP, Angewandte Mathematik, SS11
* Problem: 11346 - Probability
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=25&page=show_problem&problem=2321
*
* @author Sebastian Stumpf
* @author Benjamin Vogt
* @version 1.0, 2011-05-29 20:10:37
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 0.140
*/
public class Main
{
public static double probability(double a, double b, double S)
{
// the probability, that the rectangle defined by a and b is bigger than s is computed
// by a*b minus the integral of the funktion f(x) = S/x. You get that by the condition x*y > S.
// This Integral can also be seen by the sum of integral from S to a, integral from S to b and S.
// if S == 0, the probability is zero.
if(S == 0.0)
return 100.0;
double maxArea = a*b;
if(maxArea <= S)
return 0.0;
// this is the simplified funktion for the probability
return 100 * (maxArea - S * (1 + Math.log(maxArea / S))) / maxArea;
}

public static void main(String[] args) throws Exception
{
// test input, for all generated test cases
// int max = 500;
// System.out.println(max);
// for(int i = 0; i < max; ++i)
// {
// System.out.println(Math.random()*1000+" "+Math.random()*1000+" "+Math.random()*100000);
// System.out.println(Math.random()*1000000+" "+Math.random()*1000000+" "+Math.random()*10000000);
// }
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int testCases = Integer.valueOf(reader.readLine());
StringTokenizer tokenizer;
StringBuilder sb = new StringBuilder();
for(int i = 0; i < testCases; ++i)
{
tokenizer = new StringTokenizer(reader.readLine());
double prob = probability(Double.valueOf(tokenizer.nextToken()), Double.valueOf(tokenizer.nextToken()), Double.valueOf(tokenizer.nextToken()));
// build up the total formatted output in a StringBuilder
sb.append(String.format("%.6f%%\n", prob));
}
System.out.print(sb.toString());
}
}

---------------------------------------------

1.

package contestVolumes.volume113;

import java.util.Scanner;

/**
* FWP, Ausgewählte Probleme aus dem ACM Programming Contest, SS10
* Problem: 11346 - Probability
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=25&page=show_problem&problem=2321
*
* @author Siegfried Ippisch
* @version 1.0
*
* Method : Integration
* Status : Accepted
* Runtime: 0.252
*/
public class Probability {

public static void main(String[] args){
Scanner in = new Scanner(System.in);

int n = in.nextInt();
while(n-- > 0){
System.out.printf("%.6f%%%n",probability(in.nextDouble(),in.nextDouble(),in.nextDouble()));
}

in.close();
}

private static double probability(double a, double b, double s) {
if(s == 0)
return 100;
double all = a*b;
if(s > all)
return 0;
double x0 = s/b;
double greater = s*(Math.log(x0/a)) + b*(a-x0);
return 100*greater/all;
}

}

2.

package acm_11346_probability;

/**
* FWP, Ausgew¦hlte Probleme aus dem ACM Programming Contest, SS10
* Problem: acm_11346_probability
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=25&page=show_problem&problem=2321
*
* @author Martin Lambeck
* @version 1.0, 10.08.2010
*
* Method : stochastik
* Status : Accepted
* Runtime: 0.208
*/

import java.util.Scanner;

public class Main
{
static Scanner sc = new Scanner(System.in);

public static void main(String... args)
{
int cases = sc.nextInt();

for (int i = 0; i < cases; i++)
System.out.printf("%.6f%%%n", testcase());
}

public static double testcase()
{
double a,b,s;
double p;

a = sc.nextDouble();
b = sc.nextDouble();
s = sc.nextDouble();

if (a*b <= s)
return 0.0;
if (s == 0)
return 100.0;

//zero = s/b
//area = º (b-s/x) FOR x = [zero; a]
// => area = [x * b - s ln(x)] FOR x1 = zero, x2 = a
// => area = (a*b - s*ln(x)) - (zero*b - s*ln(x)) = ...
// p = 1 - area / totalarea = area / (a*b) = ... = 1 + (s * (ln(s / (a*b)) - 1) / (a*b)

p = 1.0 + (s * (Math.log(s / (a * b)) - 1.0)) / (a*b);

p *= 100.0;

return p;
}
}

3.

/**
* ACM Training 2009
* ACM Problem #11346 - Probability
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=25&page=show_problem&problem=2321
*
* @author Felix Dietrich
* @version 1.0, 12/03/2009
*
* Methode:
* Status : Accepted
* Runtime: 0.212
*/

import java.util.Scanner;

class Main
{
public static void main(String... s)
{
Scanner sc = new Scanner(System.in);
int testcases = sc.nextInt();
double a, b, S;
double x0;

for (int i = 0; i < testcases; i++)
{
a = sc.nextDouble();
b = sc.nextDouble();
S = sc.nextDouble();

x0 = S/b;

if (a*b <= S)
System.out.println(String.format("%.06f", 0.0) + "%");
else if (Math.abs(S) < 1e-6)
System.out.println(String.format("%.06f", 100.0) + "%");
else
System.out.println(String.format("%.06f", 100*(a*b-x0*b-S*Math.log(a/x0)) / (a*b)) + "%");
}
}
}


4.

/**
* ACM Training, WS09/10
* ACM Problem #11346 Probability
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=25&page=show_problem&problem=2321
*
* @author Doina Logofatu
* @version 1.0, 12/03/2009
*
* Methode: Math, Probability
* Status : Accepted
* Runtime: 0.008
*/

#include <stdio.h>
#include <math.h>

int main(){

int n;
double a, b, S;
double x0, P;

scanf("%d", &n);

while(n--){
scanf("%lf%lf%lf", &a, &b, &S);
x0 = S/b;

if(a*b<=S) P = 0;
else
if(S>0) P = ((a-x0)*b-S*log(a/x0))/(a*b)*100;
else P=100.;
printf("%.6lf%%\n", P);
}
return 0;

}