-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJ01005.java
29 lines (26 loc) · 881 Bytes
/
J01005.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import java.util.*;
public class J01005 {
public static void main(String[] args) {
Scanner sc = new Scanner (System.in);
int t = sc.nextInt();
while (t-- >0) {
int n = sc.nextInt();
double h = sc.nextDouble();
// Dien tich tam giac
double totalS = 0.5 * h * 1;
double onePart = totalS / n;
ArrayList<Double> a = new ArrayList<>();
for (int i = 1;i<n;i++) {
double under = onePart * i;
double height = Math.sqrt((totalS - under) * 2 * h);
a.add(height);
}
Collections.reverse(a);
for (double x : a) {
System.out.printf("%.6f", x);
System.out.print(" ");
}
System.out.println("");
}
}
}