-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathICPC_3.cpp
41 lines (41 loc) · 982 Bytes
/
ICPC_3.cpp
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
30
31
32
33
34
35
36
37
38
39
40
41
#include<stdio.h>
#include<math.h>
int main () {
int t,n,m,i;
scanf("%d",&t);
double a;
while(t--) {
scanf("%d",&n);
scanf("%d",&m);
if(m<0){
printf("-1\n");
continue;
}
if(n==1&&m!=0){
printf("-1\n");
continue;
}
a=sqrt(((double)3*m*m*n)/((double)(n/2)*((n/2)+1)*(2*(n/2)+1)));
if(n%2==1) {
if(m==0)
for(i=-n/2; i<=n/2; i++)
printf("0 ");
else
for(i=-n/2; i<=n/2; i++)
printf("%lf ",(i*a));
}
else {
if(m==0)
for(i=-n/2; i<n/2; i++)
printf("0 ");
else {
for(i=-n/2; i<0; i++)
printf("%lf ",(i*a));
for(i=1; i<=n/2; i++)
printf("%lf ",(i*a));
}
}
printf("\n");
}
return 0;
}