UVA 10056 Java
- import java.util.*;
- public class main{
- public static void main(String[] args) {
- Scanner sc=new Scanner(System.in);
- int cases = sc.nextInt();
- for(int i =0; i < cases; i++)
- {
- int n = sc.nextInt();
- double p = sc.nextDouble();
- int l = sc.nextInt();
- System.out.printf("%.4f\r\n", p == 0 ? p : (p * Math.pow(1-p, l-1))/(1 - Math.pow(1-p, n)));
- }
- }
- };
留言
張貼留言