Welcome   HUNAN NORMAL UNIVERSITY ACM/ICPC Judge Online
Home
FAQs
Problem Set
Practices
Online Contests
Major Exercises
OI Special
Judgement
Submit
Online Status
User Ranklist
Users
Register new
Login
Web Links
Hunan Normal University
College of Information Science and Engineering
点到原点的距离
Time Limit: 1000ms, Special Time Limit:2500ms, Memory Limit:32768KB
Total submit users: 20, Accepted users: 18
Problem 11614 : No special judgement
Problem description
  给出一个坐标点的坐标,求这个坐标点到原点的距离。给出的坐标可能是二维坐标也可能是三维坐标。
要求:
定义点(point)类。
计算二维坐标和三维坐标距离的函数要同名(用虚函数实现)

Input
  第一行输入一个正整数t(1<=t<=10),代表测试数据组数。从第二行开始每行一组测试数据。每组测试数据一行:首先是一个小写字母b或t,b表示该坐标是二维坐标,后面接着该点的坐标x,y。t表示该坐标是三维坐标,后面接着该点坐标x,y,z。所有坐标均为整数,且绝对值不超过100。

Output
  对输入的每个点,输出其到原点的距离,结果保留两位小数。

Sample Input
2
b 1 1
t 2 2 2
Sample Output
1.41
3.46
Submit   Clarifications   Judge Status  Problems  Ranklist 

HUNAN NORMAL UNIVERSITY ACM/ICPC Judge Online, Version 2010.5.5.final.
Web visits:2107 today,16258834 total, since 2010-05-07