19: Rescue, 19 rescue

Source: Internet
Author: User

19: Rescue, 19 rescue
19: Rescue

  • View
  • Submit
  • Statistics
  • Question
Total time limit:
1000 ms
 
Memory limit:
65536kB
Description

The rescue ship departs from the base camp and rescued several people on the roof to return to the base camp. The number of roofs and the coordinates of each roof
And the number of people will be determined by the input, find the time when all people arrive at the base camp and log on.

In the Cartesian coordinate system, the origin is the base camp. Every time a rescue ship departs from the base camp, it saves people and sends them back to the base camp. Vertices in the coordinate system represent the roof. Each roof is indicated by its positional coordinates and the number of people on it. Every time the rescue ship departs from the base camp, it will sail to the next roof at a speed of 50 meters/minute. When it reaches a roof, it will save all the people on it. Each person will arrive at the ship for one minute and return to the base camp, each person gets out of the ship for 0.5 minutes. Assume that the source and any roof do not pass through other roofs.

Input
The first line is an integer, indicating the number of roofs.
Next, there are n rows of input in sequence. Each row contains two real numbers (in meters) representing the Coordinate Position of the roof relative to the plane coordinate of the base camp, one representing the number of people, and one space between the numbers.
Open.
Output
The total time required for rescue, accurate to minutes (rounded up ).
Sample Input
130 40 3
Sample output
7
 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<cmath> 5 using namespace std; 6 int main() 7 { 8     int n; 9     double x,y,p;10     double tot;11     cin>>n;12     for(int i=1;i<=n;i++)13     {14         cin>>x>>y>>p;15         double l=sqrt(x*x+y*y);16         tot=tot+(l/50)*2+1.5*p;17     }18     cout<<ceil(tot);19     return 0;20 }

 

Related Article

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.