#include<iostream>
#include<cstdio>
#include<cmath>
int main()
{
double u, v, s, t, a;
int test=1, n;
while(scanf("%d", &n)==1)
{
if(n==0)
{
break;
}
if(n==1)
{
scanf("%lf%lf%lf", &u, &v, &t);
s=(u+v)*t/2;
a=(v-u)/t;
printf("Case %d: %0.3lf %0.3lf\n", test, s, a);
}
else if(n==2)
{
scanf("%lf%lf%lf", &u, &v, &a);
t=(v-u)/a;
s=(u+v)*t/2;
printf("Case %d: %0.3lf %0.3lf\n", test, s, t);
}
else if(n==3)
{
scanf("%lf%lf%lf", &u, &a, &s);
v=sqrt((u*u)+(2*a*s));
t=(v-u)/a;
printf("Case %d: %0.3lf %0.3lf\n", test, v, t);
}
else if(n==4)
{
scanf("%lf%lf%lf", &v, &a, &s);
u=sqrt((v*v)-(2*a*s));
t=(v-u)/a;
printf("Case %d: %0.3lf %0.3lf\n", test, u, t);
}
test++;
}
return 0;
}
#include<cstdio>
#include<cmath>
int main()
{
double u, v, s, t, a;
int test=1, n;
while(scanf("%d", &n)==1)
{
if(n==0)
{
break;
}
if(n==1)
{
scanf("%lf%lf%lf", &u, &v, &t);
s=(u+v)*t/2;
a=(v-u)/t;
printf("Case %d: %0.3lf %0.3lf\n", test, s, a);
}
else if(n==2)
{
scanf("%lf%lf%lf", &u, &v, &a);
t=(v-u)/a;
s=(u+v)*t/2;
printf("Case %d: %0.3lf %0.3lf\n", test, s, t);
}
else if(n==3)
{
scanf("%lf%lf%lf", &u, &a, &s);
v=sqrt((u*u)+(2*a*s));
t=(v-u)/a;
printf("Case %d: %0.3lf %0.3lf\n", test, v, t);
}
else if(n==4)
{
scanf("%lf%lf%lf", &v, &a, &s);
u=sqrt((v*v)-(2*a*s));
t=(v-u)/a;
printf("Case %d: %0.3lf %0.3lf\n", test, u, t);
}
test++;
}
return 0;
}
tranganiano Nick Singh Visit
ReplyDeleteWiFi Analyzer
Adobe Acrobat Pro DC
rapypolhy