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 }