1068. Radius and volume of the ball

Source: Internet
Author: User

Title Description:

Enter the center point of the ball and the coordinates of a point on the ball to calculate the radius and volume of the ball

Input:
The
center point of the ball and the coordinates of a point on the ball are entered in the following form: x0 y0 z0 x1 y1 Z1
Output:
input may have multiple groups, for each set of inputs, the radius and volume of the output ball, and the result retains three decimal places
Sample input:
 
  
Sample output:
1.732 21.766
Tips:

To avoid accuracy problems, use Arccos (-1) for PI values.

#include <iostream>#include<math.h>#include<iomanip>using namespacestd;intMain () {Doublex1,x2,y1,y2,z1,z2;  while(cin>>x1>>y1>>z1>>x2>>y2>>Z2) {    DoubleR= (X1-X2) * (X1-X2) + (y1-y2) * (y1-y2) + (Z1-Z2) * (z1-z2); R=sqrt (R); Doublev=4/3*acos (-1) *r*r*R; cout<<fixed<<setprecision (3) <<r<<" "<<v<<Endl;} return 0;}

1068. Radius and volume of the ball

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.