fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6. import java.text.DecimalFormat;
  7.  
  8. /* Name of the class has to be "Main" only if the class is public. */
  9. class Ideone
  10. {
  11. public static void main (String[] args) throws java.lang.Exception
  12. {
  13. double win, lose, outcomes, orig, adv, numer, denom, difference;
  14. DecimalFormat f = new DecimalFormat("##.00");
  15. outcomes = 20;
  16. for (float i = 0; i < outcomes; i++) {
  17. win = i;
  18. orig = i/outcomes;
  19. lose = outcomes - i;
  20.  
  21. //other way?
  22. //win/outcome + (lose/outcome)*(win/outcome)
  23.  
  24. adv = (win / outcomes) + ((lose*win)/outcomes^2));
  25.  
  26. /*numer = (win + (win * lose) );
  27. numer = Math.round(numer * 100.0) / 100.0;
  28. denom = (win + (outcomes * lose));
  29. denom = Math.round(denom * 100.0) / 100.0;
  30. adv = (numer / denom);
  31. */difference = adv - orig;
  32.  
  33. //difference = Math.round(difference * 100.0) / 100.0;
  34. System.out.println(i + "/" + outcomes + " = %" + (f.format(100*orig)) + "; %" + (f.format(100*adv)) + " >> %" + f.format(100*difference));
  35. }
  36. // your code goes here
  37. }
  38. }
Compilation error #stdin compilation error #stdout 0.14s 321280KB
stdin
Standard input is empty
compilation info
Main.java:24: error: ';' expected
			adv = (win / outcomes) + ((lose*win)/outcomes^2));
			                                                ^
1 error
stdout
Standard output is empty