CF127A.Wasted Time
入门
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Mr. Scrooge, a very busy man, decided to count the time he wastes on all sorts of useless stuff to evaluate the lost profit. He has already counted the time he wastes sleeping and eating. And now Mr. Scrooge wants to count the time he has wasted signing papers.
Mr. Scrooge's signature can be represented as a polyline _A_1_A_2... A__n. Scrooge signs like that: first it places a pen at the point _A_1, then draws a segment from point _A_1 to point _A_2, then he draws a segment from point _A_2 to point _A_3 and so on to point A__n, where he stops signing and takes the pen off the paper. At that the resulting line can intersect with itself and partially repeat itself but Scrooge pays no attention to it and never changes his signing style. As Scrooge makes the signature, he never takes the pen off the paper and his writing speed is constant — 50 millimeters per second.
Scrooge signed exactly k papers throughout his life and all those signatures look the same.
Find the total time Scrooge wasted signing the papers.
吝啬鬼先生是一位非常忙碌的人,他决定统计自己在各种无用事情上浪费的时间,以评估由此造成的利润损失。他已统计出自己在睡觉和吃饭上所浪费的时间。现在,吝啬鬼先生想要统计自己在签署文件上所浪费的时间。
吝啬鬼先生的签名可表示为一条折线 A1A2…An。他的签名过程如下:首先将笔尖置于点 A1,然后画出从点 A1 到点 A2 的线段,接着画出从点 A2 到点 A3 的线段,依此类推,直至点 An;到达点 An 后,他停止签名并将笔尖抬起离开纸面。在此过程中,所画出的线条可能与自身相交,甚至部分重叠,但吝啬鬼先生对此毫不在意,且从不改变自己的签名方式。在签名过程中,他始终不将笔尖抬起,并以恒定速度书写——每秒 50 毫米。
吝啬鬼先生一生中恰好签署了 k 份文件,且所有这些签名完全相同。
请计算吝啬鬼先生签署这些文件所浪费的总时间。
输入格式
The first line contains two integers n and k (2 ≤ n ≤ 100, 1 ≤ k ≤ 1000). Each of the following n lines contains the coordinates of the polyline's endpoints. The i-th one contains coordinates of the point A__i — integers x__i and y__i, separated by a space.
All points A__i are different. The absolute value of all coordinates does not exceed 20. The coordinates are measured in millimeters.
第一行包含两个整数 n 和 k(2≤n≤100,1≤k≤1000)。接下来的 n 行每行包含折线端点的坐标。第 i 行包含点 Ai 的坐标——两个由空格分隔的整数 xi 和 yi。
所有点 Ai 互不相同。所有坐标的绝对值均不超过 20。坐标单位为毫米。
输出格式
Print one real number — the total time Scrooges wastes on signing the papers in seconds. The absolute or relative error should not exceed 10 - 6.
输出一个实数——史古吉签署文件所浪费的总时间(单位:秒)。绝对或相对误差不得超过 10−6。
输入输出样例
输入#1
2 1 0 0 10 0
输出#1
0.200000000
输入#2
5 10 3 1 -5 6 -2 -1 3 2 10 0
输出#2
6.032163204
输入#3
6 10 5 0 4 0 6 0 3 0 7 0 2 0
输出#3
3.000000000
输入解题思路,AI测评打分。不知道怎么写?