F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Spacecraft Monitoring

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 107    Accepted Submission(s): 9


Problem Description
  In recent years, China's space industry has made rapid development, and recently launched the manned spacecraft shenzhou 10. Beauty Astronaut Wang Yaping even made a lesson in the spacecraft to the whole world. It means a lot to China's space communication. And the Nanjing University of Science and Technology also contribute their strength in communication, radar and detecting guidance.
  Today, there have been many aircrafts in space, they are communicating with each other in air, or with the ground monitoring points in ground (including fixed and mobile monitoring point). To simplify the problem, we assume that all the aircrafts and ground monitoring points are all in the equatorial plane. Aircrafts are all in synchronous orbit, suppose the earth¡¯s core as point (0, 0). We already know:
  Every aircraft¡¯s or ground monitoring point¡¯s height R relative to the earth¡¯s core, initial angle A (rad), and some communication relationship between them.
  Also every aircraft¡¯s or ground monitoring point¡¯s cost price P.
  And the ground-to-ground price per unit distance: dd, ground-to-air price per unit distance: dk (air-to-ground the same), air-to-air price per unit distance: kk.
  In order to know the general condition of the system, you should calculate the maximal average cost price of some aircrafts or ground monitoring points. The average cost price = (the sum of aircrafts¡¯ or ground monitoring points¡¯ cost price + communication cost price between them if it's existing)/(the amount of the aircrafts or ground monitoring points)
 

Input
  Multiple cases, end with EOF;
  The first line, 4 positive integers, n, dd, dk, kk, there is n aircrafts or ground monitoring points, dd, dk, kk is the same with description above. Remember that we first calculate the distance between two objects into integer, four to five homes in rounding, then calculate the communication cost price.

  Next n lines, each represents an aircraft or ground monitoring point,
if the first letter is ¡®d¡¯, it means ¡°ground monitoring point¡± in ground,
if the first letter is ¡®k¡¯, it means ¡°aircraft¡±in air,
then R,A,P, described above.

  Next an integer m, the amount of communication relationship.
  Next m lines, each line is like x, B, y, C (1<=B, C<=n, x, y = ¡®d¡¯ or ¡®k¡¯), represents object B is communicated with object C, B¡¯s type is x, C¡¯s type is y; B,C is the sequence number in particular kind ('d' or 'k') listed above, starts from 1.
  1<=n<=300, 0<=m<=n*n, 1<=dd,dk,kk<=10^6, R¡¢A are floating numbers, 0<=R<=1000,
0<=A<2*PI, 1<=P<=10^6¡£
  PS: communication between two points is considered as a segment.
 

Output
  After ¡°Case #¡± + case number + ¡±: ¡±, case number starts from 1, Output 2 numbers, separated by a blank space, first is the maximal average cost price, next is the amount of this part. The result should be corrected to four decimal places.
 

Sample Input
2 1000 2000 3000 d 2 0 1 d 3 0 4 1 d 1 d 2
 

Sample Output
Case #1: 502.5000 2
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-24 04:36:16, Gzip enabled