编程介的小学生 2019-01-30 13:45 采纳率: 20.5%
浏览 457

求多个二维数字的欧几里得的距离,分别求出每个距离长度,采用的C 语言的编程?

Problem Description
PM Room defines a sequence A = {A1, A2,..., AN}, each of which is either 0 or 1. In order to beat him, programmer Moor has to construct another sequence B = {B1, B2,... , BN} of the same length, which satisfies that:

Input
The input consists of multiple test cases. The number of test cases T(T<=100) occurs in the first line of input.

For each test case:
The first line contains a single integer N (1<=N<=100000), which denotes the length of A and B.
The second line consists of N integers, where the ith denotes Ai.

Output
Output the minimal f (A, B) when B is optimal and round it to 6 decimals.

Sample Input
4
9
1 1 1 1 1 0 0 1 1
9
1 1 0 0 1 1 1 1 1
4
0 0 1 1
4
0 1 1 1

Sample Output
1.428571
1.000000
0.000000
0.000000

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 vue2(标签-chrome|关键词-浏览器兼容)
    • ¥15 python网络流自动生成系统 医学领域
    • ¥15 sql查询仓库里都有什么
    • ¥15 代码的修改,添加和运行完善
    • ¥15 krpano-场景分组和自定义地图分组
    • ¥15 lammps Gpu加速出错
    • ¥15 关于PLUS模型中kapaa值的问题
    • ¥15 关于博途V17进行仿真时无法建立连接问题
    • ¥15 机器学习教材中的例题询问
    • ¥15 求.net core 几款免费的pdf编辑器