1137-expanding Rods

Source: Internet
Author: User

1137-expanding Rods
PDF (中文版) Statistics Forum
Time limit:0.5 second (s) Memory limit:32 MB

When a thin rod of length l was heated n degrees, it expands to a new length l ' = (1+n*c) *l, whe Re C is the coefficient of heat expansion.

When a thin rod was mounted on both solid walls and then heated, it expands and takes the shape of a circular segment, the O Riginal Rod being the chord of the segment.

Your task is to compute the distance by which the center of the rod is displaced. That means you has to calculate H as in the picture.

Input

Input starts with an integer T (≤20), denoting the number of test cases.

Each case contains three non-negative real numbers:the initial length of the rod in millimeters L, the Temperatu Re change in degrees n and the coefficient of heat expansion of the material C. Input Data Guarantee This no rod expands by more than one half of its original length. All the numbers would be between 0 and there can is at most 5 digits after the decimal point.

Output

For each case, print the case number and the displacement of the center of the rod. Errors less than 10-6 'll be ignored.

Sample Input Output for Sample Input

3

1000 100 0.0001

150 10 0.00006

10 0 0.001

Case 1:61.3289915

Case 2:2.2502024857

Case 3:0

Special Thanks:jane ALAM JAN (DESCRIPTION, Solution, DATASET, PICTURES)

Idea: L ' = p*r--p to radians

R = (L/2)/sin (P/2)

Then the formula can be converted into (2xL ')/l= (p)/sin (P/2);

Then the right derivative can be known to the right with P monotonically increase, and then two points P can.

1#include <stdio.h>2#include <algorithm>3#include <iostream>4#include <string.h>5#include <queue>6#include <stack>7#include <Set>8#include <math.h>9 using namespacestd;TentypedefLong LongLL; One DoublePi=acos (-1); A intMainvoid) - { -     inti,j,k; thescanf"%d",&k); -     ints; -     DoubleL, n,c; -      for(s=1; s<=k; s++) +     { -scanf"%lf%lf%lf",&l,&n,&c); +         DoubleL=0; A         DoubleR=2*Pi; at         intans=0; -         DoubleLl= (1+N*C) *L; -          while(ans<= -) -         { -             DoubleMid= (L+R)/2; -             DoubleAc=2*ll*sin (1.0*mid/2); in             Doubleak=l*mid; -             if(ac>=AK) to             { +L=mid; -             } the             ElseR=mid; *ans++; $         }Panax Notoginseng         DoubleRr= (1.0*l/2)/(Sin (1.0*r/2)); -         DoubleHh=rr*cos (1.0*r/2); the         Doubleh=rr-hh; +printf"Case %d:", s); Aprintf"%.6f\n", h); the     } +     return 0; -}

1137-expanding Rods

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.