UVA 10056 Java

  1. import java.util.*;
  2.  
  3. public class main{
  4. public static void main(String[] args) {
  5. Scanner sc=new Scanner(System.in);
  6. int cases = sc.nextInt();
  7. for(int i =0; i < cases; i++)
  8. {
  9. int n = sc.nextInt();
  10. double p = sc.nextDouble();
  11. int l = sc.nextInt();
  12. System.out.printf("%.4f\r\n", p == 0 ? p : (p * Math.pow(1-p, l-1))/(1 - Math.pow(1-p, n)));
  13. }
  14. }
  15. };
  16.  

留言

這個網誌中的熱門文章

C# 井字遊戲