-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathAP3.cpp
48 lines (36 loc) · 1.05 KB
/
AP3.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
42
43
44
45
46
47
48
// AC , ALGO : High School Maths.
// For any clarifications, contact me at : osinha6792@gmail.com
#include<cstdio>
#include<cmath>
using namespace std ;
int main( )
{
int test_cases ;
double n1 , n2 , sq , i , x , y , z , k , l ;
long long int n , d , a , j ;
scanf("%d",&test_cases) ;
while( test_cases-- )
{
scanf("%lf %lf %lf",&x,&y,&z) ;
i = 3.5 * x + 2.5 * y + z ;
k = i * i ;
l = 12 * z * ( x + y ) ;
sq = sqrtl( k - l ) ;
n1 = ( i + sq ) / ( x + y ) ;
n2 = ( i - sq ) / ( x + y ) ;
if( ceil(n1) == floor(n1) ) n = (llrintl)(n1) ;
else if( ceil(n2) == floor(n2) ) n =(llrintl)(n2) ;
d = (llrintl)(( y - x ) / ( n - 6 )) ;
a = (llrintl)(x - 2 * d) ;
printf("%lld\n",n) ;
printf("%lld ",a) ;
for( j = 0 ; j <= n - 3 ; j++ )
{
a += d ;
printf("%lld ",a) ;
}
a += d ;
printf("%lld\n",a) ;
}
return 0 ;
}